Code for java so far