boolean checkPaddingBytes ( QrCode qr , int lengthBytes ) { boolean a = true ; for ( int i = lengthBytes ; i < qr . corrected . length ; i ++ ) { if ( a ) { if ( 0b00110111 != ( qr . corrected [ i ] & 0xFF ) ) return false ; } else { if ( 0b10001000 != ( qr . corrected [ i ] & 0xFF ) ) { // the pattern starts over at the beginning of a block. Strictly enforcing the standard // requires knowing size of a data chunk and where it starts. Possible but // probably not worth the effort the implement as a strict requirement. if ( 0b00110111 == ( qr . corrected [ i ] & 0xFF ) ) { a = true ; } else { return false ; } } } a = ! a ; } return true ; }
Makes sure the used bytes have the expected values