public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static double[] |
abs(double[] values)
Computes the absolute values of an array of doubles.
|
static String |
blanks(int length) |
static long |
dat2num(Date date) |
static String |
dat2str(Date date)
Convert a date to the format "dd/MM/yyyy HH:mm:ss".
|
static String |
dat2str(Date date,
String format)
Some example format dd.MM.yy 09.04.98 yyyy.MM.dd G 'at' hh:mm:ss z
1998.04.09 AD at 06:15:55 PDT EEE, MMM d, ''yy Thu, Apr 9, '98 h:mm a
6:15 PM H:mm 18:15 H:mm:ss:SSS 18:15:55:624 K:mm a,z 6:15 PM,PDT
yyyy.MMMMM.dd GGG hh:mm aaa 1998.April.09 AD 06:15 PM
|
static Date |
max(Date[] dates)
Return the maximal date of an array
|
static Date |
min(Date[] dates)
Return the minimal date of an array
|
static Date |
num2dat(long value) |
static String |
num2str(char parseMode,
double num)
Same as
num2str(char parseMode, double num, int precision) but
does not query precision. |
static String |
num2str(char parseMode,
double num,
int precision)
Convert a number into a string, with
precision number of
meaningfull digits. |
static String |
num2str(double num)
Convert a number into a string.
|
static String |
num2str(double num,
int precision) |
static Date |
str2date(String string) |
static double |
sum(double[] values)
Computes the sum of an array of doubles.
|
static int |
sum(int[] values)
Computes the sum of an array of doubles.
|
static String |
time2str(long milli) |
static double[] |
vector(double min,
double max)
Generate a vector containing regular increasing values from min to max,
with an offset 1.
|
static double[] |
vector(double min,
double max,
int nstep)
Generate a vector containing regular increasing values from min to max,
with an offset of nstep.
|
static int[] |
vector(int min,
int max)
Generate a vector containing regular increasing values from min to max,
with an offset 1.
|
static int[] |
vector(int min,
int max,
int nstep)
Generate a vector containing regular increasing values from min to max,
with an offset of nstep.
|
public static String num2str(char parseMode, double num, int precision)
precision
number of
meaningfull digits.
'd' integral The result is formatted as a decimal integer 'o' integral
The result is formatted as an octal integer 'x', 'X' integral The result
is formatted as a hexadecimal integer 'e', 'E' floating point The result
is formatted as a decimal number in computerized scientific notation 'f'
floating point The result is formatted as a decimal number 'g', 'G'
floating point The result is formatted using computerized scientific
notation or decimal format, depending on the precision and the value
after rounding.://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#syntax
,
String.format
public static String num2str(char parseMode, double num)
num2str(char parseMode, double num, int precision)
but
does not query precision.public static String num2str(double num, int precision)
public static String num2str(double num)
public static String dat2str(Date date, String format)
date
- format
- ://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.
html
public static long dat2num(Date date)
public static Date num2dat(long value)
public static String time2str(long milli)
public static String blanks(int length)
public static double[] abs(double[] values)
values
- public static double sum(double[] values)
values
- public static int sum(int[] values)
values
- public static double[] vector(double min, double max, int nstep)
min
- max
- nstep
- public static double[] vector(double min, double max)
min
- max
- public static int[] vector(int min, int max, int nstep)
min
- max
- nstep
- public static int[] vector(int min, int max)
min
- max
- public static Date min(Date[] dates)
dates
- public static Date max(Date[] dates)
dates
- public static Date str2date(String string) throws ParseException
ParseException
Copyright © 2016. All rights reserved.