Java tutorial
//package com.java2s; public class Main { /** * Parse string value as boolean. Return default value if source * string is null. * @param value String * @param defValue boolean * @return boolean */ public static boolean getAsBoolean(String value, boolean defValue) { boolean result = defValue; if (value != null) { result = Boolean.parseBoolean(value); } return result; } }