static byte[] septetStream2octetStream(byte[] septets){
  int octetLength=(int)Math.ceil(((septets.length * 7)) / 8.0);
  byte[] octets=new byte[octetLength];
  for (int i=0; i < septets.length; i++) {
    for (int j=0; j < 7; j++) {
      if ((septets[i] & (1 << j)) != 0) {
        int bitIndex=(i * 7) + j;
        octets[bitIndex >>> 3]|=1 << (bitIndex & 7);
      }
    }
  }
  return octets;
}

static byte [ ] septetStream2octetStream ( byte [ ] septets ) { int octetLength = ( int ) Math . ceil ( ( ( septets . length * 7 ) ) / 8.0 ) ; byte [ ] octets = new byte [ octetLength ] ; for ( int i = 0 ; i < septets . length ; i ++ ) { for ( int j = 0 ; j < 7 ; j ++ ) { if ( ( septets [ i ] & ( 1 << j ) ) != 0 ) { int bitIndex = ( i * 7 ) + j ; octets [ bitIndex > > > 3 ] |= 1 << ( bitIndex & 7 ) ; } } } return octets ; }
convert a list of septet values into an octet stream , with a number of empty bits at the start .
