Java examples for Language Basics:String
Lower-case to upper-case string conversion
public class Main { static String LowerToUpper(String s) { String result = ""; char c;// w ww . j ava 2 s . c om for (int i = 0; i < s.length(); i++) { c = (char) (s.charAt(i) - 32); // 32=2^5 result += c; // concatenation, append c to result } return result; } public static void main(String[] args) { System.out.println(LowerToUpper("java2s.com")); } }