Isnt there a library for this built in Java?