How does the Java Garbage Collector work, and what steps can you take to prevent memory leaks in an Android application?