Simpla algorithms in Java