Here you can find the source of swap(final Object[] array, final int i, final int j)
public static void swap(final Object[] array, final int i, final int j)
//package com.java2s; //License from project: Open Source License public class Main { public static void swap(final Object[] array, final int i, final int j) { final Object tmp = array[i]; array[i] = array[j];/*from w w w . jav a2 s. co m*/ array[j] = tmp; } public static void swap(final boolean[] array, final int i, final int j) { final boolean tmp = array[i]; array[i] = array[j]; array[j] = tmp; } public static void swap(final byte[] array, final int i, final int j) { final byte tmp = array[i]; array[i] = array[j]; array[j] = tmp; } public static void swap(final char[] array, final int i, final int j) { final char tmp = array[i]; array[i] = array[j]; array[j] = tmp; } public static void swap(final short[] array, final int i, final int j) { final short tmp = array[i]; array[i] = array[j]; array[j] = tmp; } public static void swap(final int[] array, final int i, final int j) { final int tmp = array[i]; array[i] = array[j]; array[j] = tmp; } public static void swap(final long[] array, final int i, final int j) { final long tmp = array[i]; array[i] = array[j]; array[j] = tmp; } public static void swap(final float[] array, final int i, final int j) { final float tmp = array[i]; array[i] = array[j]; array[j] = tmp; } public static void swap(final double[] array, final int i, final int j) { final double tmp = array[i]; array[i] = array[j]; array[j] = tmp; } }