code: public static int decodePic(
        byte[] data,
        int dataSize,
        double[] result
    ) {
      int ri = 0;
      long count;
      IntDecoder dec = new IntDecoder(data, 0);
  
      while (dec.pos < dataSize) {
        if (dec.pos == (dataSize - 1) && dec.half) {
          if ((data[dec.pos] & 0xf) != 0x8) {
            break;
          }
        }
  
        count = dec.next();
        result[ri++] = count;
      }
      return ri;
    }
docs: Decodes data encoded by encodePic
  <p>
  result vector guaranteed to be shorter of equal to |data| * 2
  <p>
  Note that this method may throw a ArrayIndexOutOfBoundsException if it deems the input data to
  be corrupt, i.e. that the last encoded int does not use the last byte in the data. In addition
  the last encoded int need to use either the last halfbyte, or the second last followed by a 0x0
  halfbyte.
  
  @param data array of bytes to be decoded (need memorycont. repr.)
  @param dataSize number of bytes from data to decode
  @param result array were resulting doubles should be stored
  @return the number of decoded doubles