Java Number Swap swap(Integer i, Integer j)

Here you can find the source of swap(Integer i, Integer j)

Description

swap

License

Open Source License

Parameter

Parameter Description
i a parameter
j a parameter

Declaration

public static void swap(Integer i, Integer j) 

Method Source Code

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

public class Main {
    /**/*from  w  w w . ja va 2 s .co  m*/
     * @param i
     * @param j
     */
    public static void swap(Integer i, Integer j) {
        System.out.println("i=" + i + ", j=" + j);
        if (i != j) {
            i ^= j;
            j ^= i;
            i ^= j;
        }
        System.out.println("i=" + i + ", j=" + j);

    }
}

Related

  1. swap(final int value)
  2. swap(int elementWidth, long value)
  3. swap(short myShort)
  4. swap(short value)
  5. swap(short x)
  6. swap(String str, int i, int j)