0

So far what I have shifts each element to the left one, which I want to do. But I need to replace the end int with a 0 instead of duplicating it.

If it looked like [1,2,3,4,5] the output would be [2,3,4,5,0]

This is what I have so far

public static void shiftLeft ( int[] A){
    System.arraycopy(A,1,A,0,A.length - 1);
    System.out.println(Arrays.toString(A));
}

0 Answers0