public static long increment ( long serial ) { if ( serial < 0 || serial > MAX32 ) throw new IllegalArgumentException ( serial + " out of range" ) ; if ( serial == MAX32 ) return 0 ; return serial + 1 ; }
Increments a serial number . The number is assumed to be a 32 bit unsigned integer stored in a long . This basically adds 1 and resets the value to 0 if it is 2^32 .