Java Array Swap swap(byte[] buffer, int i, int j)

Here you can find the source of swap(byte[] buffer, int i, int j)

Description

swap

License

Open Source License

Declaration

public static byte[] swap(byte[] buffer, int i, int j) 

Method Source Code

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

public class Main {
    public static byte[] swap(byte[] buffer, int i, int j) {
        final byte[] result = buffer.clone();
        final byte c = result[i];
        result[i] = result[j];/*from  ww w .j ava 2 s  . c o  m*/
        result[j] = c;
        return result;
    }
}

Related

  1. swap(boolean[] array, int i1, int i2)
  2. swap(byte size, byte[] target, short targetOffset, byte[] a, short aOffset)
  3. swap(byte[] b1)
  4. swap(byte[] bytes)
  5. swap(byte[] data)
  6. swap(byte[] data, int p, int q)
  7. swap(byte[] rv, int offsetA, int offsetB)