Write code to check if a string is All Upper Case
import java.util.ArrayList; import java.util.List; public class Main{ public static void main(String[] argv){ String cs = "book2s.com"; System.out.println(isAllUpperCase(cs)); }/*from w ww .j av a 2s . c o m*/ public static boolean isAllUpperCase(String cs) { if (cs == null || isEmpty(cs)) { return false; } int sz = cs.length(); for (int i = 0; i < sz; i++) { if (Character.isUpperCase(cs.charAt(i)) == false) { return false; } } return true; } public static boolean isEmpty(String chkStr) { if (chkStr == null) { return true; } else { return "".equals(chkStr.trim()) ? true : false; } } }