Here you can find the source of null2Boolean(Object expression, boolean defValue)
public static boolean null2Boolean(Object expression, boolean defValue)
//package com.java2s; //License from project: Apache License public class Main { public static boolean null2Boolean(Object expression, boolean defValue) { try {//w ww. j a va2 s .c om return Boolean.parseBoolean(null2String(expression)); } catch (Exception e) { return defValue; } } public static String null2String(Object s) { return s == null ? "" : s.toString().trim(); } }