public static String weakIntern(String sample) {
    if (sample == null) {
      return null;
    }
    return sample.intern();
  }
@Test
  public void testWeakIntern() {
    String weakInternLiteralABC = weakIntern("ABC");
    String weakInternSubstringABC = weakIntern("ABCDE".substring(0,3));
    String weakInternHeapABC = weakIntern(new String("ABC"));
    assertSame(weakInternLiteralABC, weakInternSubstringABC);
    assertSame(weakInternLiteralABC, weakInternHeapABC);
    assertSame(weakInternSubstringABC, weakInternHeapABC);
  }