Here you can find the source of toBoolean(Object object)
public static boolean toBoolean(Object object)
//package com.java2s; //License from project: Apache License public class Main { public static boolean toBoolean(Object object) { if (object.equals(Boolean.TRUE) || (object instanceof String && (((String) object).equalsIgnoreCase("true")) || ((String) object).equalsIgnoreCase("1")) || ((object instanceof Number) && (((Number) object).intValue() == 1))) { return true; }/* ww w . j a v a 2 s.c o m*/ return false; } }