public int[] rotate(int count, int... input) {
for(int i=0; i<count; i++) {
input = rotate(input);
}
return input;
}
private int[] rotate(int... input) {
int s = input.length-1;
int[] output = new int[input.length];
for(int j=0; j < s; j++) {
output[j+1]=input[j];
}
output[0]=input[s];
return output;
}
No comments:
Post a Comment