how can i make a user enter a number, which will then shift the array to the right 1. the array cant exceed 50. please help, thanks in advance :)
List<Integer> list = new ArrayList<Integer>(1);
public void add(int value) {
list.add(0, value);
for(int i = 0; i < array.length; i++) {
list.add(index, value); // how to make the elements shift to the right?
if(list.size > 50) {
list.remove(50);
}
}
}