Here you can find the source of objToBoolean(Object o)
static public boolean objToBoolean(Object o)
//package com.java2s; //License from project: Apache License public class Main { static public boolean objToBoolean(Object o) { if (o != null) { if (o instanceof Boolean) return ((Boolean) o).booleanValue(); else if (o instanceof String) { String s = (String) o; if (s.equalsIgnoreCase("true")) return true; if (s.equalsIgnoreCase("false")) return false; if (s.equals("1")) return true; if (s.equals("0")) return false; } else if (o instanceof Integer) { Integer i = (Integer) o; if (1 == i) return true; if (0 == i) return false; }//from w ww.j a v a 2 s .c o m } return false; } }