code: public static boolean isWhitespace(CharSequence str){
          if(str!=null){
              for(int i=0; i<str.length(); i++){
                  if(!Character.isWhitespace(str.charAt(i)))
                      return false;
              }
          }
          return true;
      }
docs: returns true if <code>str</code> is null or
  it contains only whitespaces.
  <p>
  {@link Character#isWhitespace(char)} is used
  to test for whitespace