Here you can find the source of swapBytes(byte[] data)
public static byte[] swapBytes(byte[] data)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] swapBytes(byte[] data) { int totalLength = data.length; byte[] buffer = new byte[totalLength]; for (int i = 0; i < totalLength; i++) buffer[i] = data[totalLength - 1 - i]; return buffer; }/*from w ww. ja va 2 s . co m*/ }