Queue implementation with a basic array in Java