org.encog.util
Class Format
- java.lang.Object
-
- org.encog.util.Format
-
public final class Format extends java.lang.ObjectProvides the ability for Encog to format numbers and times.
-
-
Field Summary
Fields Modifier and Type Field and Description static doubleHUNDRED_PERCENTOne hundred percent.static longMEMORY_GIGBytes in a GB.static longMEMORY_KBytes in a KB.static longMEMORY_MEGBytes in a MB.static longMEMORY_TERABytes in a TB.static longMILI_IN_SECHow many miliseconds in a second.static intSECONDS_INA_DAYSeconds in a day.static intSECONDS_INA_HOURSeconds in an hour.static intSECONDS_INA_MINUTESeconds in a minute.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.lang.StringformatDouble(double d, int i)Format a double.static java.lang.StringformatInteger(int i)Format an integer.static java.lang.StringformatMemory(long memory)Format a memory amount, to something like 32 MB.static java.lang.StringformatPercent(double e)Format a percent.static java.lang.StringformatPercentWhole(double e)Format a percent with no decimal places.static java.lang.StringformatTimeSpan(int seconds)Format a time span as seconds, minutes, hours and days.static java.lang.StringformatYesNo(boolean b)Format a boolean as yes/no.
-
-
-
Field Detail
-
SECONDS_INA_MINUTE
public static final int SECONDS_INA_MINUTE
Seconds in a minute.- See Also:
- Constant Field Values
-
SECONDS_INA_HOUR
public static final int SECONDS_INA_HOUR
Seconds in an hour.- See Also:
- Constant Field Values
-
SECONDS_INA_DAY
public static final int SECONDS_INA_DAY
Seconds in a day.- See Also:
- Constant Field Values
-
MEMORY_K
public static final long MEMORY_K
Bytes in a KB.- See Also:
- Constant Field Values
-
MEMORY_MEG
public static final long MEMORY_MEG
Bytes in a MB.- See Also:
- Constant Field Values
-
MEMORY_GIG
public static final long MEMORY_GIG
Bytes in a GB.- See Also:
- Constant Field Values
-
MEMORY_TERA
public static final long MEMORY_TERA
Bytes in a TB.- See Also:
- Constant Field Values
-
MILI_IN_SEC
public static final long MILI_IN_SEC
How many miliseconds in a second.- See Also:
- Constant Field Values
-
HUNDRED_PERCENT
public static final double HUNDRED_PERCENT
One hundred percent.- See Also:
- Constant Field Values
-
-
Method Detail
-
formatDouble
public static java.lang.String formatDouble(double d, int i)Format a double.- Parameters:
d- The double value to format.i- The number of decimal places.- Returns:
- The double as a string.
-
formatInteger
public static java.lang.String formatInteger(int i)
Format an integer.- Parameters:
i- The integer to format.- Returns:
- The integer as a string.
-
formatMemory
public static java.lang.String formatMemory(long memory)
Format a memory amount, to something like 32 MB.- Parameters:
memory- The amount of bytes.- Returns:
- The formatted memory size.
-
formatPercent
public static java.lang.String formatPercent(double e)
Format a percent. Using 6 decimal places.- Parameters:
e- The percent to format.- Returns:
- The formatted percent.
-
formatPercentWhole
public static java.lang.String formatPercentWhole(double e)
Format a percent with no decimal places.- Parameters:
e- The format to percent.- Returns:
- The formatted percent.
-
formatTimeSpan
public static java.lang.String formatTimeSpan(int seconds)
Format a time span as seconds, minutes, hours and days.- Parameters:
seconds- The number of seconds in the timespan.- Returns:
- The formatted timespan.
-
formatYesNo
public static java.lang.String formatYesNo(boolean b)
Format a boolean as yes/no.- Parameters:
b- The boolean value.- Returns:
- The yes/no result.
-
-
DMelt 3.0 © DataMelt by jWork.ORG