Added Java solutions.