net.aerith.misao.util
Class Format

java.lang.Object
  |
  +--net.aerith.misao.util.Format

public class Format
extends java.lang.Object

The Format is a static class with static methods to convert number into string in proper format, and methods to convert string into number.


Constructor Summary
Format()
           
 
Method Summary
static double doubleValueOf(java.lang.String string)
          Converts String into double value.
static java.lang.String formatAngularSize(double width, double height)
          Formats the specified angular values representing the width and height and creates a new String with a proper unit.
static java.lang.String formatDouble(double value, int figures, int period)
          Formats the double number in specified figures and creates a String.
private static java.lang.String formatDouble(double value, int figures, int period, char padding)
          Formats the double number in specified figures and creates a String padding with a specified character.
static java.lang.String formatDoubleZeroPadding(double value, int figures, int period)
          Formats the double number in specified figures and creates a String with 0 padding.
static java.lang.String formatInt(int value, int figures)
          Formats the integer number in specified figures and creates a String.
private static java.lang.String formatInt(int value, int figures, char padding)
          Formats the integer number in specified figures and creates a String padding with a specified character.
static java.lang.String formatIntZeroPadding(int value, int figures)
          Formats the integer number in specified figures and creates a String with 0 padding.
static int intValueOf(byte[] b, int offset, int bytes)
          Converts a byte array into integer value.
static int intValueOf(java.lang.String string)
          Converts String into integer value.
static java.lang.String removeSpace(java.lang.String string)
          Removes space characters in the specified String.
static java.lang.String[] separatePath(java.lang.String path)
          Separates the path string by the system dependent path separator
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

Format

public Format()
Method Detail

formatInt

public static java.lang.String formatInt(int value,
                                         int figures)
Formats the integer number in specified figures and creates a String.
Parameters:
value - the number to format.
figures - the number of figures of a new string.
Returns:
the string of formatted number.

formatIntZeroPadding

public static java.lang.String formatIntZeroPadding(int value,
                                                    int figures)
Formats the integer number in specified figures and creates a String with 0 padding.
Parameters:
value - the number to format.
figures - the number of figures of a new string.
Returns:
the string of formatted number.

formatInt

private static java.lang.String formatInt(int value,
                                          int figures,
                                          char padding)
Formats the integer number in specified figures and creates a String padding with a specified character.
Parameters:
value - the number to format.
figures - the number of figures of a new string.
padding - the character for padding.
Returns:
the string of formatted number.

formatDouble

public static java.lang.String formatDouble(double value,
                                            int figures,
                                            int period)
Formats the double number in specified figures and creates a String.
Parameters:
value - the number to format.
figures - the number of figures of a new string.
period - the position of period.
Returns:
the string of formatted number.

formatDoubleZeroPadding

public static java.lang.String formatDoubleZeroPadding(double value,
                                                       int figures,
                                                       int period)
Formats the double number in specified figures and creates a String with 0 padding.
Parameters:
value - the number to format.
figures - the number of figures of a new string.
period - the position of period.
Returns:
the string of formatted number.

formatDouble

private static java.lang.String formatDouble(double value,
                                             int figures,
                                             int period,
                                             char padding)
Formats the double number in specified figures and creates a String padding with a specified character.
Parameters:
value - the number to format.
figures - the number of figures of a new string.
period - the position of period.
padding - the character for padding.
Returns:
the string of formatted number.

formatAngularSize

public static java.lang.String formatAngularSize(double width,
                                                 double height)
Formats the specified angular values representing the width and height and creates a new String with a proper unit.
Parameters:
width - the anglular value of width.
height - the anglular value of height.
Returns:
the formatted string with a proper unit.

removeSpace

public static java.lang.String removeSpace(java.lang.String string)
Removes space characters in the specified String.
Parameters:
string - the string where to remove space characters.
Returns:
the new string.

intValueOf

public static int intValueOf(byte[] b,
                             int offset,
                             int bytes)
Converts a byte array into integer value.
Parameters:
b - the byte array.
offset - the offset index to start the conversion.
bytes - the number of bytes to convert.
Returns:
the integer value.

intValueOf

public static int intValueOf(java.lang.String string)
Converts String into integer value. If some white spaces or other letters exist, if positive sign '+' is attached, if being padded by 0, it does not throw exception and converts a proper value.
Parameters:
string - the string to convert into integer value.
Returns:
the integer value.

doubleValueOf

public static double doubleValueOf(java.lang.String string)
Converts String into double value. This method can convert exponential style. If some white spaces or other letters exist, if positive sign '+' is attached, if being padded by 0, it does not throw exception and converts a proper value.
Parameters:
string - the string to convert into double value.
Returns:
the double value.

separatePath

public static java.lang.String[] separatePath(java.lang.String path)
Separates the path string by the system dependent path separator
Parameters:
path - the path string.
Returns:
the array of separated paths.