|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectij.util.Tools
public class Tools
This class contains static utility methods.
| Field Summary | |
|---|---|
static char[] |
hexDigits
This array contains the 16 hex digits '0'-'F'. |
| Constructor Summary | |
|---|---|
Tools()
|
|
| Method Summary | |
|---|---|
static String |
c2hex(Color c)
Converts a Color to an 7 byte hex string starting with '#'. |
static String |
f2hex(float f)
Converts a float to an 9 byte hex string starting with '#'. |
static String |
fixNewLines(String s)
Converts carriage returns to line feeds. |
static int |
getDecimalPlaces(double n)
Returns the number of decimal places needed to display a number, or -2 if exponential notation should be used. |
static int |
getDecimalPlaces(double n1,
double n2)
Returns the number of decimal places needed to display two numbers, or -2 if exponential notation should be used. |
static double[] |
getMinMax(double[] a)
|
static double[] |
getMinMax(float[] a)
|
static String |
int2hex(int i,
int digits)
Converts an int to a zero-padded hex string of fixed length 'digits'. |
static String |
openFromIJJarAsString(String path)
Opens a text file in ij.jar as a String (example path: "/macros/Macro_Tool.txt"). |
static double |
parseDouble(String s)
Returns a double containg the value represented by the specified String. |
static double |
parseDouble(String s,
double defaultValue)
Returns a double containg the value represented by the specified String. |
static int[] |
rank(double[] values)
Returns a sorted list of indices of the specified double array. |
static int[] |
rank(String[] data)
Returns a sorted list of indices of the specified String array. |
static String[] |
split(String str)
Splits a string into substrings using the default delimiter set, which is " \t\n\r" (space, tab, newline and carriage-return). |
static String[] |
split(String str,
String delim)
Splits a string into substring using the characters contained in the second argument as the delimiter set. |
static double[] |
toDouble(float[] a)
Converts the float array 'a' to a double array. |
static float[] |
toFloat(double[] a)
Converts the double array 'a' to a float array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final char[] hexDigits
| Constructor Detail |
|---|
public Tools()
| Method Detail |
|---|
public static String c2hex(Color c)
public static String f2hex(float f)
public static String int2hex(int i,
int digits)
public static double[] getMinMax(double[] a)
public static double[] getMinMax(float[] a)
public static double[] toDouble(float[] a)
public static float[] toFloat(double[] a)
public static String fixNewLines(String s)
public static double parseDouble(String s,
double defaultValue)
String.
s - the string to be parsed.defaultValue - the value returned if s
does not contain a parsable double
defaultValue if the string does not contain a parsable doublepublic static double parseDouble(String s)
String.
s - the string to be parsed.
public static int getDecimalPlaces(double n)
public static int getDecimalPlaces(double n1,
double n2)
public static String[] split(String str)
public static String[] split(String str,
String delim)
public static int[] rank(double[] values)
public static int[] rank(String[] data)
public static String openFromIJJarAsString(String path)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||