Java code for my practise