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