@Test
public void testForeignUTF() throws IOException {

  final String foreignText = "안녕하세요, 제 이름은 박병호입니다";
  final byte[] utf8ByteArray = createUTF8ByteArray(foreignText);
  final int length = utf8ByteArray.length;
  System.out.println("char length:" + foreignText.length()
      + " utf8BytesLength:" + utf8ByteArray.length + " for:" + foreignText);
  final Pair<Integer, Integer> pair = FileIOUtils.getUtf8Range(utf8ByteArray, 1,
      length - 6);
  System.out.println("Pair :" + pair.toString());
  final String recreatedString = new String(utf8ByteArray, 1, length - 6, "UTF-8");
  System.out.println("recreatedString:" + recreatedString);
  String correctString = new String(utf8ByteArray, pair.getFirst(),
      pair.getSecond(), "UTF-8");
  System.out.println("correctString:" + correctString);
  assertEquals(pair, new Pair<>(3, 40));
  // Two characters stripped from this.
  assertEquals(correctString.length(), foreignText.length() - 3);
  // Testing mixed bytes
  final String mixedText = "abc안녕하세요, 제 이름은 박병호입니다";
  final byte[] mixedBytes = createUTF8ByteArray(mixedText);
  final Pair<Integer, Integer> pair2 = FileIOUtils.getUtf8Range(mixedBytes, 1,
      length - 4);
  correctString = new String(mixedBytes, pair2.getFirst(), pair2.getSecond(),
      "UTF-8");
  System.out.println("correctString:" + correctString);
  assertEquals(pair2, new Pair<>(1, 45));
  // Two characters stripped from this.
  assertEquals(correctString.length(), mixedText.length() - 3);
}