public static boolean toBoolean(int value) {
        boolean result;
        if (value == TessAPI.TRUE) {
            result = true;
        } else if (value == TessAPI.FALSE) {
            result = false;
        } else {
            throw new IllegalArgumentException("Invlid boolean value. Expected " + 
                    TessAPI.TRUE  + " or " + TessAPI.FALSE + ". Got " + value);
        }
        
        return result;
    }