Some Java Utilites and algorithms