Java tutorial
//package com.java2s; public class Main { public static String toLowerString(String s) { int idx = 0; for (; idx < s.length(); idx++) { char c = s.charAt(idx); if (c >= 'A' && c <= 'Z') { break; } } if (idx == s.length()) { return s; } StringBuilder buf = new StringBuilder(s.substring(0, idx)); for (; idx < s.length(); idx++) { buf.append(toLower(s.charAt(idx))); } return buf.toString(); } public static char toLower(char c) { if (c >= 'A' && c <= 'Z') { c += 0x20; } return c; } }