Java Array Swap swapElements(final E[] arr, final int idx1, final int idx2)

Here you can find the source of swapElements(final E[] arr, final int idx1, final int idx2)

Description

swap Elements

License

Open Source License

Declaration

public static <E> void swapElements(final E[] arr, final int idx1, final int idx2) 

Method Source Code

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

public class Main {
    public static <E> void swapElements(final E[] arr, final int idx1, final int idx2) {
        final E temp = arr[idx1];
        arr[idx1] = arr[idx2];// w ww  .j av a 2s  . c  o  m
        arr[idx2] = temp;
    }
}

Related

  1. swapByteOrder32(byte[] data, int ofs, int len)
  2. swapBytes(byte[] bytes)
  3. swapBytes(byte[] data)
  4. swapBytes(byte[] dataToSwap, int wordByteLength)
  5. swapBytesAt(byte[] bytes, int p1, int p2)
  6. swapEndianFormat(byte[] b)
  7. swapInt(byte[] b, int i)
  8. swapInts(byte b[], int off, int len)
  9. swapNumbers(int i, int j, double[] array)