public void testSubstringSharesBackingArray() throws IllegalAccessException {
  String abcdefghij="ABCDEFGHIJ";
  String cdefg=abcdefghij.substring(2,7);
  assertSame(getBackingArray(abcdefghij),getBackingArray(cdefg));
}

public void testSubstringSharesBackingArray ( ) throws IllegalAccessException { String abcdefghij = "ABCDEFGHIJ" ; String cdefg = abcdefghij . substring ( 2 , 7 ) ; assertSame ( getBackingArray ( abcdefghij ) , getBackingArray ( cdefg ) ) ; }
tests a widely assumed performance characteristic of string . substring ( ) : that it reuses the original ' s backing array . although behaviour should be correct even if this test fails , many applications may suffer significant performance degradation .
