Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int[] reverseOrder(int[] array) {
- return swap(array, array.length, 0);
- }
- public static int[] swap(int[] array, int length, int pos) {
- if (pos * 2 < length) {
- int help;
- help = array[pos];
- array[pos] = array[length - 1 - pos];
- array[length - 1 - pos] = help;
- swap(array, length, pos + 1);
- }
- return array;
- }
Advertisement
Add Comment
Please, Sign In to add comment