Here you can find the source of bitShiftLeft(byte[] data)
public static byte[] bitShiftLeft(byte[] data)
//package com.java2s; public class Main { public static byte[] bitShiftLeft(byte[] data) { byte[] shifted = new byte[data.length]; int carry = 0; for (int i = data.length - 1; i >= 0; i--) { int newCarry = getMostSignificantBit(data[i]); shifted[i] = (byte) (data[i] << 1); shifted[i] |= carry;/*from ww w .ja va2 s . c o m*/ carry = newCarry; } return shifted; } public static int getMostSignificantBit(byte b) { return b >> 7 & 0x1; } }