Some algorithm (and data structure) implementation in Java