A java implementation.