Given a sample array of integers containing a zero at random location, return reversed sub array before the first 0. Give the full method implementation.
Sigiloso
public static int[] reverse(int[] sample) { int zeroIndex = -1; int[] reverted = null; for (int i = 0; i 0; --i) { reverted[(i-zeroIndex)*-1] = sample[i-1]; } return reverted; }