Recycling machine in Java