Here you can find the source of swap(int arr[], int i, int j)
public static void swap(int arr[], int i, int j)
//package com.java2s; public class Main { /**//from ww w . ja va2s . c o m * Swap two positions. */ public static void swap(int arr[], int i, int j) { int a = arr[i]; arr[i] = arr[j]; arr[j] = a; } /** * Swap two positions. */ public static void swap(float arr[], int i, int j) { float a = arr[i]; arr[i] = arr[j]; arr[j] = a; } /** * Swap two positions. */ public static void swap(double arr[], int i, int j) { double a; a = arr[i]; arr[i] = arr[j]; arr[j] = a; } /** * Swap two positions. */ public static void swap(Object arr[], int i, int j) { Object a; a = arr[i]; arr[i] = arr[j]; arr[j] = a; } }