University task on Java