Here you can find the source of toBoolean(String str)
public static Boolean toBoolean(String str)
//package com.java2s; //License from project: Apache License public class Main { public static Boolean toBoolean(String str) { if (isTrue(str)) return true; if (isFalse(str)) return false; return null; }/*from w ww .j a v a 2 s. c om*/ public static boolean isTrue(String str) { return "1".equals(str) || "true".equalsIgnoreCase(str) || "yes".equalsIgnoreCase(str) || "on".equalsIgnoreCase(str); } public static boolean isFalse(String str) { return "0".equals(str) || "false".equalsIgnoreCase(str) || "no".equalsIgnoreCase(str) || "off".equalsIgnoreCase(str); } }