CollisionDJBX31A implements CollisionInterface { @Override public String getCollisionString( int i, int n ) { byte[] StringCollision0 = { 't', 't' }; byte[] StringCollision1 = { 'u', 'U' }; byte[] StringCollision2 = { 'v', '6' }; int numberElements = 2 * n; byte[] output = new byte[numberElements]; for ( int j = 0; j < numberElements; j = j + 2 ) { output[j] = 't'; output[j + 1] = 't'; } int divisor = i; int rest = 0; int count = 2 * n - 1; while ( divisor != 0 ) { rest = divisor % 3; divisor = divisor / 3; 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; case 2: output[count] = StringCollision2[1]; output[count - 1] = StringCollision2[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() { int i = 9 - 1; int n = 2; CollisionDJBX31A instance = new CollisionDJBX31A(); String expResult = "v6v6"; String result = instance.getCollisionString( i, n ); assertEquals( expResult, result ); }