ByteUtil { public static String narrowToWide(final String str) { int len = str.length(); StringBuilder buf = new StringBuilder(len); for (int i=0; i<len; i++) { int codePoint = str.codePointAt(i); if (Character.isSupplementaryCodePoint(codePoint)) { buf.appendCodePoint(codePoint); i = i + Character.charCount(codePoint) - 1; continue; } switch (codePoint) { case ' ': buf.append('\u3000'); break; case '\'': buf.append('\u2019'); break; case '"': buf.append('\u201d'); break; default: if (codePoint >= 0x21 && codePoint <= 0x7e) { codePoint = codePoint + 0xfee0; } buf.appendCodePoint(codePoint); break; } } return buf.toString(); } private  ByteUtil(); static int getInt2(final byte[] b, final int offset); static int getInt3(final byte[] b, final int offset); static int getIntLE2(final byte[] b, final int offset); static int getBCD2(final byte[] b, final int offset); static int getBCD4(final byte[] b, final int offset); static long getLong4(final byte[] b, final int offset); static long getLong5(final byte[] b, final int offset); static long getLongLE4(final byte[] b, final int offset); static String narrowToWide(final String str); static String wideToNarrow(final String str); static int asciiToJISX0208(final int code); static int jisx0201ToJISX0208(final int code); static String gb2312ToString(final byte[] b); static String gb2312ToString(final byte[] b, final int offset, final int len); static String jisx0208ToString(final byte[] b); static String jisx0208ToString(final byte[] b, final int offset, final int len); static byte[] stringToJISX0208(final String str); static void katakanaToHiragana(final byte[] b); static void hiraganaToKatakana(final byte[] b); static void upperToLowerLatin(final byte[] b); static void lowerToUpperLatin(final byte[] b); static void upperToLower(final byte[] b); static void lowerToUpper(final byte[] b); static void convertLongVowel(final byte[] b); static void deleteLongVowel(final byte[] b); static void convertDoubleConsonant(final byte[] b); static void convertContractedSound(final byte[] b); static void convertVoicedConsonant(final byte[] b); static void convertSmallVowel(final byte[] b); static void convertPSound(final byte[] b); static void deleteMark(final byte[] b); static void deleteSpaceLatin(final byte[] b); static void deleteSpace(final byte[] b); static void reverseWordLatin(final byte[] b); static void reverseWord(final byte[] b);  }
@Test public void testNarrowToWide() throws Exception { String s = "abcdef012389"; String expected = "\uFF41\uFF42\uFF43\uFF44\uFF45\uFF46\uFF10\uFF11\uFF12\uFF13\uFF18\uFF19"; assertEquals(ByteUtil.narrowToWide(s), expected); }