Java - Write code to check if a string is Blank using Character.isWhitespace()

Requirements

Write code to check if a string is Blank using Character.isWhitespace()

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String str = "book2s.com";
        System.out.println(isBlank(str));
    }//w  w  w .ja v  a  2s .com

    public static boolean isBlank(String str) {
        int strLen;
        if (str == null || (strLen = str.length()) == 0)
            return true;
        for (int i = 0; i < strLen; i++)
            if (!Character.isWhitespace(str.charAt(i)))
                return false;

        return true;
    }
}