Here you can find the source of swap(byte[] b1)
public static byte[] swap(byte[] b1)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] swap(byte[] b1) { for (int i = 0; i < (b1.length - 4); i = i + 4) { byte temp = b1[i]; b1[i] = b1[i + 1];/*from w w w .j a va 2s .c o m*/ b1[i + 1] = b1[i + 2]; b1[i + 2] = b1[i + 3]; b1[i + 3] = temp; } return b1; } }