package jalview.util; public class ArrayUtils { /** * Reverse the given array 'in situ' * * @param arr */ public static void reverseIntArray(int[] arr) { if (arr != null) { /* * swap [k] with [end-k] up to the half way point in the array * if length is odd, the middle entry is left untouched by the excitement */ int last = arr.length - 1; for (int k = 0; k < arr.length / 2; k++) { int temp = arr[k]; arr[k] = arr[last - k]; arr[last - k] = temp; } } } }