My Java homework