public static boolean decrement ( byte [ ] value ) { for ( int i = value . length ; -- i >= 0 ; ) { byte newValue = ( byte ) ( ( value [ i ] & 0xff ) + - 1 ) ; value [ i ] = newValue ; if ( newValue != - 1 ) { // No borrow bit, so done subtracting. return true ; } } // This point is reached upon overflow. return false ; }
Subtracts one from an unsigned integer represented as a byte array . If overflowed value in byte array is 0xff 0xff 0xff ...