Moving a java version I did as a class project to ruby