Here you can find the source of reverseBits(byte[] bits)
private static void reverseBits(byte[] bits)
//package com.java2s; public class Main { private static void reverseBits(byte[] bits) { for (int i = 0; i < 4; i++) { byte temp = bits[i]; bits[i] = bits[bits.length - i - 1]; bits[bits.length - i - 1] = temp; }// w w w .j a v a2 s . c om } }