src/org/jnetpcap/util/DataUtils.java
public static byte[] diff(final byte[] b1, final byte[] b2) {

		final int max = (b1.length > b2.length) ? b1.length : b2.length;
		final byte[] b = new byte[max];

		for (int i = 0; i < max; i++) {

			final byte t1 = (i < b1.length) ? b1[i] : 0;
			final byte t2 = (i < b2.length) ? b2[i] : 0;

			b[i] = (byte) (t2 - t1);
		}
		
		return b;
	}
/**
	 * Returns the difference between b1 and b2. b1 is subtracted from b2.
	 * 
	 * @param b1
	 *          the b1
	 * @param b2
	 *          the b2
	 * @return array containing the different between b1 and b2
	 */
Returns the difference between b1 and b2. b1 is subtracted from b2.

@param b1
the b1
@param b2
the b2
@return array containing the different between b1 and b2
Returns the difference between b1 and b2 . b1 is subtracted from b2 . @param b1 the b1 @param b2 the b2 @return array containing the different between b1 and b2
public static byte[] diff(final byte[] b1, final byte[] b2) {
		final int max = (b1.length > b2.length) ? b1.length : b2.length;
		final byte[] b = new byte[max];
		for (int i = 0; i < max; i++) {
			final byte t1 = (i < b1.length) ? b1[i] : 0;
			final byte t2 = (i < b2.length) ? b2[i] : 0;
			b[i] = (byte) (t2 - t1);
		}
		return b;
	}
public static byte [ ] diff ( final byte [ ] b1 , final byte [ ] b2 ) { final int max = ( b1 . length > b2 . length ) ? b1 . length : b2 . length ; final byte [ ] b = new byte [ max ] ; for ( int i = 0 ; i < max ; i ++ ) { final byte t1 = ( i < b1 . length ) ? b1 [ i ] : 0 ; final byte t2 = ( i < b2 . length ) ? b2 [ i ] : 0 ; b [ i ] = ( byte ) ( t2 - t1 ) ; } return b ; }
Returns the difference between b1 and b2.
Returns the difference between b1 and b2 .