code: public boolean optBoolean(String key, boolean defaultValue) {
          Object val = this.opt(key);
          if (NULL.equals(val)) {
              return defaultValue;
          }
          if (val instanceof Boolean){
              return ((Boolean) val).booleanValue();
          }
          try {
              // we'll use the get anyway because it does string conversion.
              return this.getBoolean(key);
          } catch (Exception e) {
              return defaultValue;
          }
      }
docs: Get an optional boolean associated with a key. It returns the
  defaultValue if there is no such key, or if it is not a Boolean or the
  String "true" or "false" (case insensitive).
  
  @param key
  A key string.
  @param defaultValue
  The default.
  @return The truth.