Java tutorial
//package com.java2s; public class Main { /** checks if a string consists of all whitespace characters * * @param s the string to be checked * @return true if the string consists of all whitespace chars */ public static boolean isWhite(String s) { if (s == null) return true; int len = s.length(); for (int i = 0; i < len; i++) { if (!Character.isWhitespace(s.charAt(i))) return false; } return true; } }