### Question:
NFold { protected static byte[] sum( byte[] n1, byte[] n2, int len ) { int numOfBytes = ( len - 1 ) / 8 + 1; byte[] out = new byte[numOfBytes]; int carry = 0; for ( int i = len - 1; i > -1; i-- ) { int n1b = getBit( n1, i ); int n2b = getBit( n2, i ); int sum = n1b + n2b + carry; if ( sum == 0 || sum == 1 ) { setBit( out, i, sum ); carry = 0; } else if ( sum == 2 ) { carry = 1; } else if ( sum == 3 ) { setBit( out, i, 1 ); carry = 1; } } if ( carry == 1 ) { byte[] carryArray = new byte[n1.length]; carryArray[carryArray.length - 1] = 1; out = sum( out, carryArray, n1.length * 8 ); } return out; }  static byte[] nFold( int n, byte[] data );  }### Answer:
@Test public void testSum() { byte[] n1 = { ( byte ) 0x86, ( byte ) 0x5E }; byte[] n2 = { ( byte ) 0xAC, ( byte ) 0x60 }; byte[] n3 = { ( byte ) 0x71, ( byte ) 0x2A }; byte[] n4 = { ( byte ) 0x81, ( byte ) 0xB5 }; byte[] sum = NFold.sum( n1, n2, n1.length * 8 ); sum = NFold.sum( sum, n3, sum.length * 8 ); sum = NFold.sum( sum, n4, sum.length * 8 ); byte[] result = new byte[] { ( byte ) 0x25, ( byte ) 0x9F }; assertTrue( Arrays.equals( sum, result ) ); }