Here you can find the source of rotateArray(Object[] array, int amt)
public static Object[] rotateArray(Object[] array, int amt)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { public static Object[] rotateArray(Object[] array, int amt) { Object[] arr = Arrays.copyOf(array, array.length); if (arr == null || amt < 0) { throw new IllegalArgumentException("Illegal argument!"); }//from w w w. j a v a 2 s. c o m for (int i = 0; i < amt; i++) { for (int j = arr.length - 1; j > 0; j--) { Object temp = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = temp; } } return arr; } public static float[] rotateArray(float[] array, int amt) { float[] arr = Arrays.copyOf(array, array.length); if (arr == null || amt < 0) { throw new IllegalArgumentException("Illegal argument!"); } for (int i = 0; i < amt; i++) { for (int j = arr.length - 1; j > 0; j--) { float temp = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = temp; } } return arr; } }