Here you can find the source of swap(byte[] buffer, int i, int j)
public static byte[] swap(byte[] buffer, int i, int j)
//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; } }