Random code for practicing Java and revising algorithms