Here you can find the source of toBoolean(Object value)
public static Boolean toBoolean(Object value)
//package com.java2s; //License from project: Apache License public class Main { public static Boolean toBoolean(Object value) { if (value instanceof Boolean) { return (Boolean) value; }/*from w w w . j a va 2 s . co m*/ if (value instanceof String) { return "true".equalsIgnoreCase(value.toString()) ? Boolean.TRUE : Boolean.FALSE; } if (value instanceof Integer) { return (Integer) value > 0 ? Boolean.TRUE : Boolean.FALSE; } return null; } }