Here you can find the source of swap(T[] a, int idx1, int idx2)
protected static <T> void swap(T[] a, int idx1, int idx2)
//package com.java2s; public class Main { /**/*from w w w . j a v a 2s.c o m*/ * Swaps two elements in an array. */ protected static <T> void swap(T[] a, int idx1, int idx2) { T tmp = a[idx1]; a[idx1] = a[idx2]; a[idx2] = tmp; } }