StrUtil { public static String reverseNew(String s) { int length = s.length(); char[] rev = new char[length]; for (int i = 0; i < length; i++) { rev[i] = s.charAt(length - i -1); } return new String(rev); }  static String reverseInPlace(String s ); static String reverseNew(String s);  }
@Test public void testReverseNew() { assertEquals("", StrUtil.reverseNew("")); assertEquals("olleh", StrUtil.reverseNew("hello")); assertEquals("nellaf", StrUtil.reverseNew("fallen")); }