/** * Returns the element of the given big array of specified index. * * @param array a big array. * @param index a position in the big array. * @return the element of the big array at the specified position. */ public static int get(final int[][] array, final long index) { return array[segment(index)][displacement(index)]; }
/** * Swaps the element of the given big array of specified indices. * * @param array a big array. * @param first a position in the big array. * @param second a position in the big array. */ public static void swap(final int[][] array, final long first, final long second) { final int t = array[segment(first)][displacement(first)]; array[segment(first)][displacement(first)] = array[segment(second)][displacement(second)]; array[segment(second)][displacement(second)] = t; }
/** * Sets the element of the given big array of specified index. * * @param array a big array. * @param index a position in the big array. */ public static void set(final int[][] array, final long index, int value) { array[segment(index)][displacement(index)] = value; }
/** * Returns the element of the given big array of specified index. * * @param array a big array. * @param index a position in the big array. * @return the element of the big array at the specified position. */ public static int get(final int[][] array, final long index) { return array[segment(index)][displacement(index)]; }
/** * Sets the element of the given big array of specified index. * * @param array a big array. * @param index a position in the big array. */ public static void set(final int[][] array, final long index, int value) { array[segment(index)][displacement(index)] = value; }
/** * Swaps the element of the given big array of specified indices. * * @param array a big array. * @param first a position in the big array. * @param second a position in the big array. */ public static void swap(final int[][] array, final long first, final long second) { final int t = array[segment(first)][displacement(first)]; array[segment(first)][displacement(first)] = array[segment(second)][displacement(second)]; array[segment(second)][displacement(second)] = t; }