General Java code for algorithms and data structures