Here you can find the source of swap(int[] array, int idx1, int idx2)
public static void swap(int[] array, int idx1, int idx2)
//package com.java2s; //License from project: Open Source License public class Main { public static void swap(int[] array, int idx1, int idx2) { if (idx1 != idx2) { array[idx1] = array[idx1] + array[idx2]; array[idx2] = array[idx1] - array[idx2]; array[idx1] = array[idx1] - array[idx2]; }// ww w . j a v a2 s .c o m } }