Some algorithms on Java.