Here you can find the source of toBoolean(Object o)
public static Boolean toBoolean(Object o)
//package com.java2s; public class Main { public static Boolean toBoolean(Object o) { Boolean b;/*from ww w . jav a2 s . c o m*/ if (o instanceof Boolean) { b = (Boolean) o; } else { String s = o.toString(); if (s.equalsIgnoreCase("true")) { b = Boolean.TRUE; } else if (s.equalsIgnoreCase("false")) { b = Boolean.FALSE; } else { b = null; } } return b; } }