http://sys.cs.rice.edu/course/comp314/10/p2/javabits.html