Here you can find the source of toBoolean(Object bool)
public static boolean toBoolean(Object bool)
//package com.java2s; public class Main { public static boolean toBoolean(Object bool) { if (bool == null) return false; if (bool instanceof Boolean) { boolean b = ((Boolean) bool).booleanValue(); return b; }/*from www . j av a 2 s.c om*/ bool = bool.toString(); if (bool.equals("true") || bool.equals("y") || bool.equals("on") || bool.equals("1")) return true; return false; } }