added basic java implementation together with the required tests