public int [ ] getTopLeftOnBit ( ) { int bitsOffset = 0 ; while ( bitsOffset < bits . length && bits [ bitsOffset ] == 0 ) { bitsOffset ++ ; } if ( bitsOffset == bits . length ) { return null ; } int y = bitsOffset / rowSize ; int x = ( bitsOffset % rowSize ) * 32 ; int theBits = bits [ bitsOffset ] ; int bit = 0 ; while ( ( theBits << ( 31 - bit ) ) == 0 ) { bit ++ ; } x += bit ; return new int [ ] { x , y } ; }
This is useful in detecting a corner of a pure barcode .