public static int[] createMSBMask(int bits){
  int m=0, orig=32 - bits;
  while (bits-- > 0) {
    m|=1;
    m<<=1;
  }
  while (--orig > 0) {
    m<<=1;
  }
  return new int[]{(m >> 24) & 0xFF,(m >> 16) & 0xFF,(m >> 8) & 0xFF,m & 0xFF};
}

public static int [ ] createMSBMask ( int bits ) { int m = 0 , orig = 32 - bits ; while ( bits -- > 0 ) { m |= 1 ; m <<= 1 ; } while ( -- orig > 0 ) { m <<= 1 ; } return new int [ ] { ( m > > 24 ) & 0xFF , ( m > > 16 ) & 0xFF , ( m > > 8 ) & 0xFF , m & 0xFF } ; }
creates a 4 byte bit - mask based on the amount of bits provided shifted to msb
