Java Array Swap swap(int[] a, int first, int second)

Here you can find the source of swap(int[] a, int first, int second)

Description

swap

License

Open Source License

Declaration

public static void swap(int[] a, int first, int second) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static void swap(int[] a, int first, int second) {

        if (first == second) {
            return;
        }/* w w w .  j a  v a 2 s  .  co  m*/

        int temp = a[first];
        a[first] = a[second];
        a[second] = temp;
    }
}

Related

  1. swap(int array[], int first, int last)
  2. swap(int arrs[], int i, int j)
  3. swap(int i, int j, Integer[] unsorted)
  4. swap(int i, int j, String[] index)
  5. swap(int keys[], int values[], int a, int b)
  6. swap(int[] a, int i, int j)
  7. swap(int[] arr, int a, int b)
  8. swap(int[] arr, int a, int b)
  9. swap(int[] arr, int a, int b, int c, int d, int key)