CollisionDJBX33A implements CollisionInterface { @Override public String getCollisionString( int i, int n ) { byte[] StringCollision0 = { 'A', 'z' }; byte[] StringCollision1 = { 'C', '8' }; int numberElements = 2 * n; byte[] output = new byte[numberElements]; for ( int j = 0; j < numberElements; j = j + 2 ) { output[j] = 'A'; output[j + 1] = 'z'; } int divisor = i; int rest = 0; int count = 2 * n - 1; while ( divisor != 0 ) { rest = divisor % 2; divisor = divisor / 2; switch ( rest ) { case 0: output[count] = StringCollision0[1]; output[count - 1] = StringCollision0[0]; break; case 1: output[count] = StringCollision1[1]; output[count - 1] = StringCollision1[0]; break; } count -= 2; } return new String( output ); }  @Override int getHash( String s ); @Override void genNCollisions( int numberAttributes, StringBuilder sb, boolean useNamespace ); @Override String getCollisionString( int i, int n );  }
@Test public void testGetCollisionString() { System.out.println( "Test getCollisionString-DJBX33A" ); int i = 4 - 1; int n = 2; CollisionDJBX33A instance = new CollisionDJBX33A(); String expResult = "C8C8"; String result = instance.getCollisionString( i, n ); assertEquals( expResult, result ); }