Here you can find the source of swap(int[] arr, int a, int b, int c, int d, int key)
public static void swap(int[] arr, int a, int b, int c, int d, int key)
//package com.java2s; //License from project: Open Source License public class Main { public static void swap(int[] arr, int a, int b, int c, int d, int key) { int temp; switch (key) { case 0:/* ww w.j a v a2 s . c o m*/ temp = arr[d]; arr[d] = arr[c]; arr[c] = arr[b]; arr[b] = arr[a]; arr[a] = temp; return; case 1: temp = arr[a]; arr[a] = arr[c]; arr[c] = temp; temp = arr[b]; arr[b] = arr[d]; arr[d] = temp; return; case 2: temp = arr[a]; arr[a] = arr[b]; arr[b] = arr[c]; arr[c] = arr[d]; arr[d] = temp; return; } } public static void swap(byte[] arr, int a, int b, int c, int d, int key) { byte temp; switch (key) { case 0: temp = arr[d]; arr[d] = arr[c]; arr[c] = arr[b]; arr[b] = arr[a]; arr[a] = temp; return; case 1: temp = arr[a]; arr[a] = arr[c]; arr[c] = temp; temp = arr[b]; arr[b] = arr[d]; arr[d] = temp; return; case 2: temp = arr[a]; arr[a] = arr[b]; arr[b] = arr[c]; arr[c] = arr[d]; arr[d] = temp; return; } } }