Java solutions