private void qtreeBitins64(byte[] a,int lnx,int lny,LongArrayPointer b,int n,int bit){
  int i, j, s00;
  long planeVal=1L << bit;
  ByteBuffer k=ByteBuffer.wrap(a);
  for (i=0; i < lnx - 1; i+=2) {
    s00=n * i;
    for (j=0; j < lny - 1; j+=2) {
      byte value=k.get();
      if ((value & BIT_ONE) != ZERO) {
        b.bitOr(s00 + n + 1,planeVal);
      }
      if ((value & BIT_TWO) != ZERO) {
        b.bitOr(s00 + n,planeVal);
      }
      if ((value & BIT_THREE) != ZERO) {
        b.bitOr(s00 + 1,planeVal);
      }
      if ((value & BIT_FOUR) != ZERO) {
        b.bitOr(s00,planeVal);
      }
      s00+=2;
    }
    if (j < lny) {
      byte value=k.get();
      if ((value & BIT_TWO) != ZERO) {
        b.bitOr(s00 + n,planeVal);
      }
      if ((value & BIT_FOUR) != ZERO) {
        b.bitOr(s00,planeVal);
      }
    }
  }
  if (i < lnx) {
    s00=n * i;
    for (j=0; j < lny - 1; j+=2) {
      byte value=k.get();
      if ((value & BIT_THREE) != ZERO) {
        b.bitOr(s00 + 1,planeVal);
      }
      if ((value & BIT_FOUR) != ZERO) {
        b.bitOr(s00,planeVal);
      }
      s00+=2;
    }
    if (j < lny) {
      if ((k.get() & BIT_FOUR) != ZERO) {
        b.bitOr(s00,planeVal);
      }
    }
  }
}

private void qtreeBitins64 ( byte [ ] a , int lnx , int lny , LongArrayPointer b , int n , int bit ) { int i , j , s00 ; long planeVal = 1L << bit ; ByteBuffer k = ByteBuffer . wrap ( a ) ; for ( i = 0 ; i < lnx - 1 ; i += 2 ) { s00 = n * i ; for ( j = 0 ; j < lny - 1 ; j += 2 ) { byte value = k . get ( ) ; if ( ( value & BIT_ONE ) != ZERO ) { b . bitOr ( s00 + n + 1 , planeVal ) ; } if ( ( value & BIT_TWO ) != ZERO ) { b . bitOr ( s00 + n , planeVal ) ; } if ( ( value & BIT_THREE ) != ZERO ) { b . bitOr ( s00 + 1 , planeVal ) ; } if ( ( value & BIT_FOUR ) != ZERO ) { b . bitOr ( s00 , planeVal ) ; } s00 += 2 ; } if ( j < lny ) { byte value = k . get ( ) ; if ( ( value & BIT_TWO ) != ZERO ) { b . bitOr ( s00 + n , planeVal ) ; } if ( ( value & BIT_FOUR ) != ZERO ) { b . bitOr ( s00 , planeVal ) ; } } } if ( i < lnx ) { s00 = n * i ; for ( j = 0 ; j < lny - 1 ; j += 2 ) { byte value = k . get ( ) ; if ( ( value & BIT_THREE ) != ZERO ) { b . bitOr ( s00 + 1 , planeVal ) ; } if ( ( value & BIT_FOUR ) != ZERO ) { b . bitOr ( s00 , planeVal ) ; } s00 += 2 ; } if ( j < lny ) { if ( ( k . get ( ) & BIT_FOUR ) != ZERO ) { b . bitOr ( s00 , planeVal ) ; } } } }
copy 4 - bit values from a [ ( nx + 1 ) / 2 , ( ny + 1 ) / 2 ] to b [ nx , ny ] , expanding each value to 2x2 pixels and inserting into bitplane bit of b . a , b may not be same tiledimageoperation ( it wouldn ' t make sense to be inserting bits into the same tiledimageoperation anyway . )
