Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static boolean getBooleanValue(Object o, boolean defaultVal) {
        if (o == null)
            return Boolean.valueOf(defaultVal);
        if (o.toString().trim().length() == 0)
            return Boolean.valueOf(defaultVal);
        if (o instanceof Boolean)
            return (Boolean) o;
        if (o instanceof String)
            return Boolean.parseBoolean((String) o);

        return Boolean.valueOf(defaultVal);
    }
}