Java Properties Get getPropertyDouble(Properties p, String key)

Here you can find the source of getPropertyDouble(Properties p, String key)

Description

convert a properties value into an int

License

Apache License

Parameter

Parameter Description
p non-null properties
key non-null id of an existing key

Exception

Parameter Description
NumberFormatException if the value is not a number

Return

double value - MIN_VALUE if the key does not exist

Declaration

public static double getPropertyDouble(Properties p, String key) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    /**//from w w w . j  a va  2 s .c  o  m
     * convert a properties value into an int
     * @param p non-null properties
     * @param key non-null id of an existing key
     * @return double value - MIN_VALUE if the key does not exist
     * @throws NumberFormatException if the value is not a number
     */
    public static double getPropertyDouble(Properties p, String key) {
        Object test = p.get(key);
        if (test == null)
            return (Double.MIN_VALUE);
        return (Double.parseDouble(test.toString()));
    }

    /**{ method
     @name toString
     @function convert a char to a string
     @param c the char
     @return the String
     }*/
    public static String toString(char c) {
        StringBuffer s = new StringBuffer();
        s.append(c);
        return (s.toString());
    }
}

Related

  1. getProperty(Properties props, String keyword)
  2. getProperty(Properties props, String prefix, String key)
  3. getProperty(Properties props, String propertyName)
  4. getProperty(Properties props, String propname)
  5. getProperty(String[] system_props, Properties props, String prop_name, boolean ignore_sysprops, String default_value)
  6. getPropertyLong(Properties properties, String context, String key, Long def)
  7. getPropertyString(Properties properties, String propertyName)
  8. getPropertyText(String property, Object... replacements)
  9. getPropertyValue(Properties props, String key)