7 Replies Latest reply on Dec 5, 2008 3:55 PM by 807589

    Getting subset of bits from int array and form byte array

    807589
      I would like to have write a method in Java with following signature:
      public byte[] extractBytes(int[] input);

      Argument to the method is an array of 32 ints. As int in Java is 32 bits, we are providing 1024 bits of input.

      I want the method to return an array of 107 bytes (856 bits), where the bytes start from 85 th bit(including) of input and end at 938 bit (including) of input - 854 bits. The 2 LSBs of the 107th byte are unsed.

      Can I please have solution ?