Tools
ij.util

Class Tools



  • public class Toolsextends Object
    This class contains static utility methods.
    • Field Summary

      Fields 
      Modifier and TypeField and Description
      static char[]hexDigits
      This array contains the 16 hex digits '0'-'F'.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Tools() 
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      static Stringc2hex(Color c)
      Converts a Color to an 7 byte hex string starting with '#'.
      static Stringf2hex(float f)
      Converts a float to an 9 byte hex string starting with '#'.
      static StringfixNewLines(String s)
      Converts carriage returns to line feeds.
      static intgetDecimalPlaces(double n1, double n2)
      Returns the number of decimal places need to display two numbers.
      static double[]getMinMax(double[] a) 
      static double[]getMinMax(float[] a) 
      static doubleparseDouble(String s)
      Returns a double containg the value represented by the specified String.
      static doubleparseDouble(String s, double defaultValue)
      Returns a double containg the value represented by the specified String.
      static voidquicksort(double[] a, int[] index) 
      static voidquicksort(double[] a, int[] index, int left, int right) 
      static voidquicksort(String[] a, int[] index) 
      static voidquicksort(String[] a, int[] index, int left, int right) 
      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.
    • Field Detail

      • hexDigits

        public static final char[] hexDigits
        This array contains the 16 hex digits '0'-'F'.
    • Constructor Detail

      • Tools

        public Tools()
    • Method Detail

      • c2hex

        public static String c2hex(Color c)
        Converts a Color to an 7 byte hex string starting with '#'.
      • f2hex

        public static String f2hex(float f)
        Converts a float to an 9 byte hex string starting with '#'.
      • getMinMax

        public static double[] getMinMax(double[] a)
      • getMinMax

        public static double[] getMinMax(float[] a)
      • toDouble

        public static double[] toDouble(float[] a)
        Converts the float array 'a' to a double array.
      • toFloat

        public static float[] toFloat(double[] a)
        Converts the double array 'a' to a float array.
      • fixNewLines

        public static String fixNewLines(String s)
        Converts carriage returns to line feeds.
      • parseDouble

        public static double parseDouble(String s,                 double defaultValue)
        Returns a double containg the value represented by the specified String.
        Parameters:
        s - the string to be parsed.
        defaultValue - the value returned if s does not contain a parsable double
        Returns:
        The double value represented by the string argument or defaultValue if the string does not contain a parsable double
      • parseDouble

        public static double parseDouble(String s)
        Returns a double containg the value represented by the specified String.
        Parameters:
        s - the string to be parsed.
        Returns:
        The double value represented by the string argument or Double.NaN if the string does not contain a parsable double
      • getDecimalPlaces

        public static int getDecimalPlaces(double n1,                   double n2)
        Returns the number of decimal places need to display two numbers.
      • split

        public 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).
      • split

        public static String[] split(String str,             String delim)
        Splits a string into substring using the characters contained in the second argument as the delimiter set.
      • quicksort

        public static void quicksort(double[] a,             int[] index)
      • quicksort

        public static void quicksort(double[] a,             int[] index,             int left,             int right)
      • quicksort

        public static void quicksort(String[] a,             int[] index)
      • quicksort

        public static void quicksort(String[] a,             int[] index,             int left,             int right)

SCaVis 2.0 © jWork.ORG