package samples.string.japanese; public class ZenkakuAlphabetToHankakuAlphabet { public static String zenkakuAlphabetToHankaku(String s) { StringBuffer sb = new StringBuffer(s); for (int i = 0; i < sb.length(); i++) { char c = sb.charAt(i); if (c >= 'a' && c <= 'z') { sb.setCharAt(i, (char) (c - 'a' + 'a')); } else if (c >= 'A' && c <= 'Z') { sb.setCharAt(i, (char) (c - 'A' + 'A')); } } return sb.toString(); } public static void main(String[] args) { System.out.println (zenkakuAlphabetToHankaku ("☆ Programmation Java ☆")); } }