ccl.util
Class Util

java.lang.Object
  |
  +--ccl.util.Util

public class Util
extends java.lang.Object

A general purpose class with a variety of support and convenience methods.

There are different groups of methods in this class:

debug and assertion methods
print methods - convenience methods for System.out.print etc. that additionally make sure output is gets flushed immediately.
basic converter methods
string methods
string/vector converter methods
vector methods
sorting and inserting methods
system methods
date methods
random generator methods
miscellaneous methods

Some basic but none the less the most used methods by myself are:
- println
- printlnErr
- isEmpty
- stringToLines
- atoi
- itoa
- systemAndWait
- sleep
- getDate

But there are also some gems which are less regularly used but still quite usefull:
- getStackTrace(java.lang.Throwable)
- getDump(java.lang.Object)
- formatMemoryInfo()
- denullify(java.lang.String)
- formatBlock(java.lang.String, int)

Potential future but not yet existing classes to move some code into are:
StringUtil, VectorUtil, SystemUtil, and maybe Debug.


Field Summary
static java.lang.Object O_CONSTANT
          This could be also private and instead you would have to use getConstantObject(), but yet you have the choice.
 
Method Summary
static java.lang.String appendSpaces(java.lang.String pString_, int length_)
          Append spaces to the end of a string.
static void assert(boolean bAssert_)
          Deprecated. use 'assert' keyword from jdk 1.4 or above.
static void assert(java.lang.Object pObject_)
          Deprecated. use 'assert' keyword from jdk 1.4 or above.
static boolean atob(java.lang.String pString_)
          Converts a String to a boolean.
static double atod(java.lang.String pString_)
          String to double converter.
static float atof(java.lang.String pString_)
          String to float converter.
static int atoi(java.lang.String pString_)
          String to int converter.
static long atol(java.lang.String pString_)
          String to long converter.
static int btoi(byte b_)
          Deprecated. Use byteToInt(byte) instead.
static int bytesToInt(byte[] abInt)
          Converts a byte array into an int.
static char byteToChar(byte b_)
          Converts a byte to a char.
static int byteToInt(byte b_)
          Converts a byte to an int.
static java.lang.String byteToString(byte b_)
          Converts a byte to a String.
static java.lang.String centerLine(java.lang.String pString, int lineLength)
          Returns a string withe the provided content in the center and no line feed.
static int compare(java.lang.String firstString, java.lang.String anotherString)
          Deprecated. Use String.compare instead.
static java.lang.String concat(java.lang.String pString_, char cWidth_)
          This function concatenates a String with a char.
static java.lang.String concat(java.util.Vector pVector_)
          This function concatenates different Strings into one String.
static java.lang.String concat(java.util.Vector pVector_, char cWith_)
          This function concatenates different Strings into one String.
static java.lang.String concat(java.util.Vector pVector_, java.lang.String sWith_)
          This function concatenates different Strings into one String.
static java.util.Vector concat(java.util.Vector vFirst_, java.util.Vector vSecond_)
          Create a new vector which consists of both given vectors.
static int contains(java.lang.String sToLookIn_, java.lang.String sThis_)
          Deprecated. Well, String.indexOf(String) should be just fine!?
static boolean contains(java.util.Vector pVector_, java.lang.String sFind_)
          Test if a vector contains a given string.
static boolean contains(java.util.Vector pVector_, ccl.util.Testable pFilter_)
          Test if a vector contains an element which succeeds a given test filter.
static int count(java.lang.String pString_, char c_)
          How many chars c_ contains the String pString_.
static java.lang.String cToS(char c_)
          A character to String converter.
static void debug(int i)
          If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.
static void debug(java.lang.Object oMessage_)
          If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.
static void debug(java.lang.Object oOriginator_, java.lang.Object oMessage_)
          If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.
static java.lang.String denullify(java.lang.String pString_)
          Returns "" if the input string is null, otherwise returns the same string back.
static java.lang.String dtoa(double d_)
          Converts a double to a String.
static boolean endsWith(java.lang.String sThis_, char cOther_)
          Tests if this string ends with the specified character.
static boolean endsWith(java.lang.String pString_, java.lang.String sEnd_)
          Tests if this string ends with the second string.
static java.util.Vector enumerationToVector(java.util.Enumeration pEnumeration_)
          Convert an enumeration to a vector.
static boolean equals(java.util.Vector vFirst_, java.util.Vector vSecond_)
          Do the elements of two vectors at the same position equal each other?
static boolean equalsCaseless(java.lang.String sA_, java.lang.String sB_)
          Compares two strings.
static java.util.Vector filter(java.util.Vector pVector_, java.lang.Object oBadElement_)
          All object in this vector which equal the bad element are not copied over to the resulting vector.
static java.util.Vector filter(java.util.Vector pVector_, ccl.util.Testable pFilter_)
          Create a new vector and copy all elements of the pVector_ paramter over which are accepted by the test filter.
static java.util.Vector filter(java.util.Vector pVector_, java.util.Vector vBadElements_)
          All object in this vector which equal an object in the bad vector are not copied over to the resulting vector.
static java.lang.String firstCharToLowerCase(java.lang.String pString_)
          Returns the given string with the first char converted to lower case.
static java.lang.String firstCharToUpperCase(java.lang.String pString_)
          Returns the given string with the first char converted to upper case.
static java.lang.String formatBlock(java.lang.String pString)
          This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned as a block.
static java.lang.String formatBlock(java.lang.String pString, int lineLength)
          This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned as a block.
static java.lang.String formatBlock(java.lang.String pString, int lineLength, int indentation)
          This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned as a block.
static java.lang.String formatCenter(java.lang.String pString, int lineLength)
          This method takes a string and reformats it so that each line has no more than the given length and the text will be centered in the middle.
static java.lang.String formatLeft(java.lang.String pString)
          This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned to the left side.
static java.lang.String formatLeft(java.lang.String pString, int lineLength)
          This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned to the left side.
static java.lang.String formatLeft(java.lang.String pString, int lineLength, int indentation)
          This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned to the left side.
static java.lang.String formatMemoryInfo()
          Returns a message which has nicely formatted information about the current memory usage.
static void gc()
          System.gc() does not always garanty immediate execution.
static java.util.Calendar getCalendar()
           
static java.util.Calendar getCalendar(java.lang.String sTimeZoneID_)
          This is a replacement of the SimpleTimeZone.getTimeZone(String) function that additionally creates a GregorianCalendar of the given timezone.
static java.lang.Object getConstantObject()
          Sometimes you need a dummy object just to have any value for a hashtable or so and it doesn't matter at all if we always use the same object, so here is one you can use without wasting extra memory.
static java.lang.String getDate()
          Returns the current date as an ISO date string.
static java.lang.String getDate(java.util.Calendar pCalendar_)
          Returns the given date as an ISO date string.
static java.util.Calendar getDate(java.lang.String sDate_)
          For example: 1999-11-26.
static java.lang.String getDateTimeAndMillis()
          Returns a string consiting of the iso date, time, and milli seconds, all concatenated without any space, colon, or dash.
static int getDiffPosition(java.lang.String s1, java.lang.String s2)
          Finds out the first position (started with 0) at which two strings start to differ.
static java.lang.String getDump(java.lang.Object object_)
          This method returns a string with dump out of all its attribute fields, private as well as public fields.
static java.lang.String getFirstDayOfMonth(java.lang.String sDate_)
          Provide an iso date string and get back an iso date string which has the day set to one.
static java.lang.String getHeuteSortable()
          Deprecated.  
static java.lang.String getLastDayOfMonth(java.lang.String sDate_)
          Provide an iso date string and get back an iso date string with the last day in the same month.
static java.lang.String getLocalHostName()
          Get the name of the localhost.
static java.lang.String getMonth(java.lang.String sDate)
          Returns the English name of the month of the given iso-date.
static java.lang.String getNextDay(java.lang.String sDate_)
          Provides the iso date of the next day after the given date.
static int getNumberOfDays(java.lang.String sFrom_, java.lang.String sTo_)
          Return the number of days between to dates.
static java.lang.String getObjectName(java.lang.Object pObject_)
          pObject_.getClass().getName() returns the name including its package.
static int getOccurances(java.lang.String source, int zeichen)
          Count how often a string contains a special char.
static int getOccurances(java.lang.String source_, java.lang.String lookFor_)
          Count how often a string is contained in another string.
static java.lang.String getSpaces(int length_)
          Returns a String which consists only of spaces and has the lenght 'length_' or which is empty if length_ equals zero.
static java.lang.String getStackTrace(java.lang.Throwable pThrowable_)
          Returns a string which contains the stack trace.
static java.lang.String getStandardDate(java.util.Date pDate_)
           
static java.lang.String getTime(java.util.Calendar pCalendar_)
           
static java.lang.String getTime(java.util.Date pDate_)
          Returns the time as a string of the given date object.
static java.lang.String getTimeWithMillis()
          Returns the current time with milli seconds.
static java.lang.String getTimeWithMillis(java.util.Calendar calendar_)
          Returns the current time with milli seconds.
static java.lang.String getTodaySortable()
          Deprecated. use getDate() instead.
static long getUsedMemory()
          This method returns the memory currently in use.
static java.lang.String getUsedMemoryPercentage()
          This method returns the percentage of used memory.
static java.lang.String getUsedMemoryPercentage(long used, long total)
          This method returns the percentage of used memory.
static int indexOfNot(java.lang.String pString_, char cNot_)
           
static int indexOfNot(java.lang.String pString_, char cNot_, int startIndex_)
           
static int insert(java.util.Vector pVector_, int lowestOffset_, int highestOffset_, java.lang.Object pObject_, ccl.util.Comparable pComparable_)
          Inert a new object into a vector and keep the vector sorted.
static int insert(java.util.Vector pVector_, java.lang.Object pObject_, ccl.util.Comparable pComparable_)
          Inert a new object into a vector and keep the vector sorted.
static java.util.Vector insert(java.util.Vector vDestination_, java.util.Vector vOther_, int destination)
          Insert at a special offset all elements of the second vector into the first vector.
static byte[] intToBytes(int i_)
          Converts an int into a byte array.
static java.util.Vector invert(java.util.Vector vSource_)
          Create a new vector and invert the order of the elements.
static boolean isAlpha(char c_)
          Checks that a character is of type alpha.
static boolean isDateValid(java.lang.String sDate_)
          Input format of the date is either CCYY-MM-DD or CCYYMMDD.
static boolean isDebug()
          Returns the current debug mode.
static boolean isDigit(char c_)
          Return true for digit characters.
static boolean isEmpty(java.lang.String sTest_)
          Tests, if a given String equals null or "".
static boolean isEmpty(java.util.Vector vTest_)
          Tests, if a given Vector is null or has size 0.
static boolean isOSLinux()
          Returns true if the current operating system is Linux.
static boolean isOSSolaris()
          Returns true if the current operating system is Sun Microsystem's Solaris (or SunOS).
static boolean isOSUnix()
          Returns true if the current operating system is either Linux or Solaris.
static boolean isOSWindows()
          Returns true if the current operating system is Microsoft Windows.
static boolean isSpaceLine(java.lang.String sLine_)
          Tests if a string contains only space, tab, and linefeed characters.
static boolean isSwingPackage(java.lang.String sFullPackageName_)
          Returns true if sFullPackageName_ is a swing package, either old com.sun.java.swing or new javax.swing convention.
static boolean isTrue(java.lang.Boolean pBoolean_)
          Boolean to boolean converter.
static boolean isVocal(char c_)
          Return true if the given character can be found in the string "aeoui???".
static java.lang.String itoa(int i_)
          Converts an int to a String.
static java.lang.String ltoa(long l_)
          Converts an long to a String.
static double ltod(long l_)
          A long to double converter.
static java.lang.String ltrim(java.lang.String s)
          Removes space, carriage, linefeed, and tab chars at the right side of a string.
static java.util.Vector map(java.util.Vector pVector_, ccl.util.Transformable pTransformable_)
          Convert each element of the vector by a transformation object.
static int max(int a_, int b_)
          Deprecated.  
static long max(long a_, long b_)
          Deprecated.  
static int min(int a_, int b_)
          Deprecated.  
static java.lang.String multiplyChar(char c, int anzahl)
          Create a string by concatenating one char several times.
static java.lang.String multiplyChar(java.lang.String sFill, int anzahl)
          Create a string by concatenating one string several times.
static java.util.Vector objectsToVector(java.lang.Object[] apObjects)
          Convert an array of objects to a vector.
static java.lang.String paddWith(int number_, int stellen_, char cPadd_)
          Fill a string with a given char for alignment purposes.
static java.lang.String paddWith(java.lang.String pString_, int stellen_, char cPadd_)
          Fill a string with a given char for alignment purposes.
static java.lang.String paddWithSpace(double dNumber_, int stellen)
          Fill a string with space chars for alignment purposes.
static java.lang.String paddWithSpace(int number, int stellen)
          Fill a string with space chars for alignment purposes.
static java.lang.String paddWithSpace(long number, int stellen)
          Fill a string with space chars for alignment purposes.
static java.lang.String paddWithSpace(java.lang.String pString_, int stellen)
          Fill a string with space chars for alignment purposes.
static java.lang.String paddWithZero(int number, int stellen)
          Fill a string with zero chars for alignment purposes.
static java.lang.String paddWithZero(long number, int stellen)
          Fill a string with zero chars for alignment purposes.
static java.lang.String paddWithZero(java.lang.String sNumber_, int stellen_)
          Fill a string with zero chars for alignment purposes.
static void panicIf(boolean bPanic_)
          panicIf <=> not assert.
static void panicIf(boolean bPanic_, java.lang.String sMessage_)
          panicIf <=> not assert.
static void print(char c_)
          Prints out a char to System.out.
static void print(java.lang.Object pObject_)
          Prints out the object to System.out.
static void print(java.lang.String pString_)
          Prints out a String to System.out.
static void printErr(char c_)
          Prints out a char to System.err.
static void printErr(java.lang.Object pObject_)
          Prints out the object to System.err.
static void printErr(java.lang.String pString_)
          Prints out a String to System.err.
static void println()
          Same as print('\n').
static void println(java.lang.Exception e)
          Prints out the exception, its stack trace, and the current thread to System.out!
static void println(java.lang.Object pObject_)
          Prints out the object to System.out together with a new line.
static void println(java.lang.String pString_)
          Prints out a String to System.out together with a new line.
static void printlnErr()
          The same as println, except output goes to std err.
static void printlnErr(java.lang.Exception exception_)
          Prints out an error report for an exception to System.err.
static void printlnErr(java.lang.Object pObject_)
          Prints out the object to System.err.
static void printlnErr(java.lang.Object oClass_, java.lang.Object oMessage_)
          Prints out a String with a prefix of the oClass_ class name to System.err.
static void printlnErr(java.lang.String sMessage_)
          The same as println, except output goes to std err.
static void quickSort(java.lang.Object[] s, int lo, int hi, ccl.util.Comparable cmp)
          An implementation of Quicksort using medians of 3 for partitions.
static void quickSort(java.util.Vector v, int lo, int hi, ccl.util.Comparable cmp)
          An implementation of Quicksort using medians of 3 for partitions.
static java.lang.String removeMultipleSpaces(java.lang.String pString_)
          What the method name says.
static java.lang.String replace(java.lang.String pString_, char cOld_, char cNew_)
          Replaces all occurences of cOld_ in pString with cNew_.
static java.lang.String replace(java.lang.String pString_, char cOld_, char cNew_, int startIndex_)
          Replaces all occurences of cOld_ in pString with cNew_.
static java.lang.String replace(java.lang.String pString_, java.lang.String sOld_, java.lang.String sNew_)
          Replaces all occurences of sOld_ in pString with sNew_.
static java.lang.String replace(java.lang.String pString_, java.lang.String sOld_, java.lang.String sNew_, int startIndex_)
          Replaces all occurences of sOld_ in pString with sNew_.
static java.lang.String rightPaddWithSpace(java.lang.String pString_, int stellen)
          Add spaces at the right side of a string if necessary.
static boolean rnd()
           
static double rnd(double df)
          Returns the a pseudorandom double number between 0.0 and excluding the provided double value.
static float rnd(float f)
          Returns the a pseudorandom float number between 0.0 and excluding the provided float value.
static int rnd(int end_)
          Random number in the range [0, end_] (both inclusive).
static int rnd(int start_, int end_)
          Random number in the range [start_, end_] (both inclusive).
static java.lang.String rtrim(java.lang.String s)
          Removes space, carriage, linefeed, and tab chars at the right side of a string.
static void setDate(java.util.Calendar pCalendar_, java.lang.String sDate_)
           
static void setDebug(boolean bDebug_)
          Sets the debug mode for the running application.
static void setDebug(java.lang.String sDebug_)
          Sets the debug mode for the running application.
static void setTime(java.util.Calendar pCalendar_, java.lang.String sTime_)
           
static void showLiveSignal()
          For batch applications to indicate progess to the user.
static void showLiveSignal(char c_)
          For batch applications to indicate progess to the user.
static java.lang.String shrinkString(java.lang.String pString, int maxSize)
          Reformat a string which is not longer than a given size.
static void sleep(int seconds_)
          Current thread sleeps in seconds.
static java.util.Vector sort(java.util.Enumeration pEnumeration_)
          Quicksort for Enumeration.
static java.util.Vector sort(java.util.Enumeration pEnumeration_, ccl.util.Comparable pComparable_)
          Quicksort for Enumeration.
static java.util.Vector sort(java.util.Vector pVector_)
          Uses Quicksort using medians of 3 for partitions.
static java.util.Vector sort(java.util.Vector vInput_, ccl.util.Comparable pComparable_)
          Uses Quicksort using medians of 3 for partitions and the
static java.util.Vector sortCaseSensitive(java.util.Vector pVector_)
          Case sensitive sort has 'Zorro' ordered before 'arthur'.
static void sortFast(java.util.Vector pVector_)
          Uses Quicksort using medians of 3 for partitions.
static void sortFast(java.util.Vector vInput_, ccl.util.Comparable pComparable_)
          Like sort but works directly on the input vector.
static java.util.Date stringToDate(java.lang.String sDate_)
          Input format of the date is either CCYY-MM-DD or CCYYMMDD.
static java.util.Vector stringToLines(int lines_, java.lang.String pString_)
          This function takes a String and separates it into different lines.
static java.util.Vector stringToLines(int lines_, java.lang.String pString_, char cCutter_)
          This function takes a String and separates it into different lines.
static java.util.Vector stringToLines(java.lang.String pString_)
          This function takes a String and separates it into different lines.
static java.util.Vector stringToLines(java.lang.String pString_, char cCutter_)
          This function takes a String and separates it into different lines.
static java.util.Vector stringToLines(java.lang.String sLines_, java.lang.String sCutter_)
          This function takes a String and separates it into different lines.
static java.util.Vector stringToLines(java.lang.String sLines_, java.lang.String sTokenizerString_, boolean bUseTokenizer_)
          This function takes a String and separates it into different lines.
static java.util.Vector subtract(java.util.Vector vSource_, java.util.Vector vToDelete_)
          Create a new vector through extracting all elements of the second vector from the first vector.
static java.lang.Object swap()
          This method is the second step of a service to swap two objects in less than 3 steps.
static java.lang.Object swap(java.lang.Object objFirst, java.lang.Object objSecond)
          This method is the first part of a service to swap two objects in less than 3 steps.
static int swapInt()
          This method is the second step of a service to swap two int values in less than 3 steps.
static int swapInt(int first, int second)
          This method is the first part of a service to swap two int values in less than 3 steps.
static java.lang.Process system(java.lang.String sCommand_)
          This method does return immediately.
static java.lang.Process system(java.lang.String[] asCommand_)
          Execute an external command.
static java.lang.Process system(java.util.Vector vArgs_)
          Execute an external command.
static java.lang.String systemAndGetError(java.lang.String commandline)
          Does a system exec and returns the stderr output.
static java.lang.String systemAndGetError(java.util.Vector vArgs_)
          Does a system exec and returns the stderr output.
static java.lang.String systemAndWait(java.lang.String commandline)
          Does a system exec and returns the stdout.
static java.lang.String systemAndWait(java.util.Vector vArgs_)
          Does a system exec and returns the stdout.
static int toLowerCase(int character_)
          Works with ints instead of chars.
static java.lang.String toString(java.lang.Object pObject_)
          Before returning pObject_.toString() it checks if pObject_ is null.
static int toUpperCase(int character_)
          Works with ints instead of chars.
static java.util.Vector toVector(java.util.Enumeration pEnumeration_)
          Enumeration to Vector converter.
static java.lang.String unifySpaces(java.lang.String s)
          Seems to do the same as 'removeMultipleSpaces(String)'.
static java.lang.String untabify(java.lang.String pString)
          Replaces tabs with spaces, a maximum of 8 each.
static java.lang.Object[] vectorToObjects(java.util.Vector pVector_)
          Convenience class for java.util.Vector.copyInto(..).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

O_CONSTANT

public static final java.lang.Object O_CONSTANT
This could be also private and instead you would have to use getConstantObject(), but yet you have the choice.

See Also:
getConstantObject()
Method Detail

setDebug

public static void setDebug(boolean bDebug_)
Sets the debug mode for the running application. When true, all following debug statements are equal to println statements, otherwise they are ignored.

See Also:
debug(Object)

isDebug

public static boolean isDebug()
Returns the current debug mode.

Returns:
the current debug mode.

setDebug

public static void setDebug(java.lang.String sDebug_)
Sets the debug mode for the running application. When true, all following debug statements are equal to printlnErr statements, otherwise they are ignored.

See Also:
debug(Object)

debug

public static void debug(java.lang.Object oMessage_)
If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.

See Also:
setDebug(boolean)

debug

public static void debug(int i)
If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.

See Also:
setDebug(boolean)

debug

public static void debug(java.lang.Object oOriginator_,
                         java.lang.Object oMessage_)
If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.

See Also:
setDebug(boolean), printlnErr(java.lang.Object, java.lang.Object)

panicIf

public static void panicIf(boolean bPanic_)
panicIf <=> not assert. Throws ApplicationException if true. It's not necessary to catch this exception.

See Also:
ApplicationException

panicIf

public static void panicIf(boolean bPanic_,
                           java.lang.String sMessage_)
panicIf <=> not assert. Throws ApplicationException if true. It's not necessary to catch this exception.

Parameters:
sMessage_ - The error message for the Exception.
See Also:
ApplicationException

assert

public static void assert(boolean bAssert_)
Deprecated. use 'assert' keyword from jdk 1.4 or above.

Most people are used to assertions. But I once came up with panicIf(boolean) and that's what I still prefer to use.


assert

public static void assert(java.lang.Object pObject_)
Deprecated. use 'assert' keyword from jdk 1.4 or above.

Assert pObject is not null.


print

public static void print(char c_)
Prints out a char to System.out. Unlike using System.out directly this method makes sure the content gets flushed out immediately.


print

public static void print(java.lang.String pString_)
Prints out a String to System.out. Unlike using System.out directly this method makes sure the content gets flushed out immediately.


print

public static void print(java.lang.Object pObject_)
Prints out the object to System.out. Unlike using System.out directly this method makes sure the content gets flushed out immediately.


println

public static void println(java.lang.String pString_)
Prints out a String to System.out together with a new line. Unlike using System.out directly this method makes sure the content gets flushed out immediately.

Parameters:
pString_ - a string without a trailing newline to send to standard output.

println

public static void println(java.lang.Exception e)
Prints out the exception, its stack trace, and the current thread to System.out! Unlike using System.out directly this method makes sure the content gets flushed out immediately.

See Also:
printlnErr

println

public static void println(java.lang.Object pObject_)
Prints out the object to System.out together with a new line. Unlike using System.out directly this method makes sure the content gets flushed out immediately.


println

public static void println()
Same as print('\n').

See Also:
print

printErr

public static void printErr(char c_)
Prints out a char to System.err.


printErr

public static void printErr(java.lang.String pString_)
Prints out a String to System.err.


printErr

public static void printErr(java.lang.Object pObject_)
Prints out the object to System.err.


printlnErr

public static void printlnErr()
The same as println, except output goes to std err.


printlnErr

public static void printlnErr(java.lang.String sMessage_)
The same as println, except output goes to std err. Unlike using System.err directly this method makes sure the content gets flushed out immediately.

Parameters:
sMessage_ - a string without a trailing newline to send to standard error.

printlnErr

public static void printlnErr(java.lang.Object pObject_)
Prints out the object to System.err. Unlike using System.err directly this method makes sure the content gets flushed out immediately.

Parameters:
pObject_ - an object that will be converted to a string which will be sent to standard error with a newline appended.

printlnErr

public static void printlnErr(java.lang.Exception exception_)
Prints out an error report for an exception to System.err. Prints out the exception message followed by its stack trace. Unlike using System.err directly this method makes sure the content gets flushed out immediately.

Parameters:
exception_ - the exception to print to standard error.

printlnErr

public static void printlnErr(java.lang.Object oClass_,
                              java.lang.Object oMessage_)
Prints out a String with a prefix of the oClass_ class name to System.err.


showLiveSignal

public static void showLiveSignal()
For batch applications to indicate progess to the user.


showLiveSignal

public static void showLiveSignal(char c_)
For batch applications to indicate progess to the user.

Parameters:
c_ - The char that should be printed to stdout.

atoi

public static int atoi(java.lang.String pString_)
String to int converter.


atol

public static long atol(java.lang.String pString_)
String to long converter.


itoa

public static java.lang.String itoa(int i_)
Converts an int to a String.


ltoa

public static java.lang.String ltoa(long l_)
Converts an long to a String.


dtoa

public static java.lang.String dtoa(double d_)
Converts a double to a String.


atof

public static float atof(java.lang.String pString_)
String to float converter. An empty string gets converted to 0.0, while a string that is not adequately formatted results in NaN (not a number).


atod

public static double atod(java.lang.String pString_)
String to double converter. An empty string gets converted to 0.0, while a string that is not adequately formatted results in NaN (not a number). '\'' chars are removed from the String before processing takes place.


ltod

public static double ltod(long l_)
A long to double converter.

Parameters:
l_ - the long value to convert to a double.
Returns:
the double equivalent to the given long.

intToBytes

public static byte[] intToBytes(int i_)
Converts an int into a byte array. First byte has the highest value.

See Also:
bytesToInt(byte[])

bytesToInt

public static int bytesToInt(byte[] abInt)
Converts a byte array into an int. First byte has the highest value.

See Also:
intToBytes(int)

byteToChar

public static char byteToChar(byte b_)
Converts a byte to a char.


btoi

public static int btoi(byte b_)
Deprecated. Use byteToInt(byte) instead.

Converts a byte to an int.


byteToInt

public static int byteToInt(byte b_)
Converts a byte to an int.


byteToString

public static java.lang.String byteToString(byte b_)
Converts a byte to a String.


cToS

public static java.lang.String cToS(char c_)
A character to String converter.


toUpperCase

public static int toUpperCase(int character_)
Works with ints instead of chars.


toLowerCase

public static int toLowerCase(int character_)
Works with ints instead of chars.


atob

public static boolean atob(java.lang.String pString_)
Converts a String to a boolean. It's true if the string consists of the word "true" ignoring case, otherwise it returns false.

Returns:
((pString_ != null) && pString_.toLowerCase().equals("true"));

isTrue

public static boolean isTrue(java.lang.Boolean pBoolean_)
Boolean to boolean converter.

Returns:
true if input is true, false otherwise or if input is null.

isEmpty

public static boolean isEmpty(java.lang.String sTest_)
Tests, if a given String equals null or "".


getOccurances

public static int getOccurances(java.lang.String source,
                                int zeichen)
Count how often a string contains a special char.


getOccurances

public static int getOccurances(java.lang.String source_,
                                java.lang.String lookFor_)
Count how often a string is contained in another string.


multiplyChar

public static java.lang.String multiplyChar(char c,
                                            int anzahl)
Create a string by concatenating one char several times.


multiplyChar

public static java.lang.String multiplyChar(java.lang.String sFill,
                                            int anzahl)
Create a string by concatenating one string several times. The method name should maybe renamed to multiplyString or something else.


getSpaces

public static java.lang.String getSpaces(int length_)
Returns a String which consists only of spaces and has the lenght 'length_' or which is empty if length_ equals zero.


appendSpaces

public static java.lang.String appendSpaces(java.lang.String pString_,
                                            int length_)
Append spaces to the end of a string. The returned string will always have exactly the requested length_.


paddWith

public static java.lang.String paddWith(int number_,
                                        int stellen_,
                                        char cPadd_)
Fill a string with a given char for alignment purposes.


paddWith

public static java.lang.String paddWith(java.lang.String pString_,
                                        int stellen_,
                                        char cPadd_)
Fill a string with a given char for alignment purposes.


paddWithSpace

public static java.lang.String paddWithSpace(int number,
                                             int stellen)
Fill a string with space chars for alignment purposes.


paddWithSpace

public static java.lang.String paddWithSpace(long number,
                                             int stellen)
Fill a string with space chars for alignment purposes.


paddWithSpace

public static java.lang.String paddWithSpace(double dNumber_,
                                             int stellen)
Fill a string with space chars for alignment purposes.


paddWithSpace

public static java.lang.String paddWithSpace(java.lang.String pString_,
                                             int stellen)
Fill a string with space chars for alignment purposes.


rightPaddWithSpace

public static java.lang.String rightPaddWithSpace(java.lang.String pString_,
                                                  int stellen)
Add spaces at the right side of a string if necessary.


paddWithZero

public static java.lang.String paddWithZero(int number,
                                            int stellen)
Fill a string with zero chars for alignment purposes.


paddWithZero

public static java.lang.String paddWithZero(long number,
                                            int stellen)
Fill a string with zero chars for alignment purposes.


paddWithZero

public static java.lang.String paddWithZero(java.lang.String sNumber_,
                                            int stellen_)
Fill a string with zero chars for alignment purposes.


removeMultipleSpaces

public static java.lang.String removeMultipleSpaces(java.lang.String pString_)
What the method name says.


rtrim

public static java.lang.String rtrim(java.lang.String s)
Removes space, carriage, linefeed, and tab chars at the right side of a string.


ltrim

public static java.lang.String ltrim(java.lang.String s)
Removes space, carriage, linefeed, and tab chars at the right side of a string.


unifySpaces

public static java.lang.String unifySpaces(java.lang.String s)
Seems to do the same as 'removeMultipleSpaces(String)'. One should become deprecated.


equalsCaseless

public static boolean equalsCaseless(java.lang.String sA_,
                                     java.lang.String sB_)
Compares two strings. Upper or lower case characters are not considered differently.


firstCharToUpperCase

public static java.lang.String firstCharToUpperCase(java.lang.String pString_)
Returns the given string with the first char converted to upper case.


firstCharToLowerCase

public static java.lang.String firstCharToLowerCase(java.lang.String pString_)
Returns the given string with the first char converted to lower case.


endsWith

public static boolean endsWith(java.lang.String sThis_,
                               char cOther_)
Tests if this string ends with the specified character.


endsWith

public static boolean endsWith(java.lang.String pString_,
                               java.lang.String sEnd_)
Tests if this string ends with the second string.


replace

public static java.lang.String replace(java.lang.String pString_,
                                       char cOld_,
                                       char cNew_)
Replaces all occurences of cOld_ in pString with cNew_.

See Also:
String.replace(char, char)

replace

public static java.lang.String replace(java.lang.String pString_,
                                       char cOld_,
                                       char cNew_,
                                       int startIndex_)
Replaces all occurences of cOld_ in pString with cNew_.


replace

public static java.lang.String replace(java.lang.String pString_,
                                       java.lang.String sOld_,
                                       java.lang.String sNew_)
Replaces all occurences of sOld_ in pString with sNew_. Unlike the String.replace(char, char) method this one accepts whole strings for replacement and as a consequence also allows to delete sub strings.

Parameters:
pString_ - a string that shall get some sub strings replaced.
sOld_ - a string for which all occurences in the first string shall be replaced.
sNew_ - a string which will be used for replacement of the old sub strings.
Returns:
the first string provided but with the replaced sub strings.

replace

public static java.lang.String replace(java.lang.String pString_,
                                       java.lang.String sOld_,
                                       java.lang.String sNew_,
                                       int startIndex_)
Replaces all occurences of sOld_ in pString with sNew_.

Parameters:
startIndex_ - The startindex_ gives the position in pString_ where the replace procedure should start.

isSpaceLine

public static boolean isSpaceLine(java.lang.String sLine_)
Tests if a string contains only space, tab, and linefeed characters.


untabify

public static java.lang.String untabify(java.lang.String pString)
Replaces tabs with spaces, a maximum of 8 each.


denullify

public static java.lang.String denullify(java.lang.String pString_)
Returns "" if the input string is null, otherwise returns the same string back.


toString

public static java.lang.String toString(java.lang.Object pObject_)
Before returning pObject_.toString() it checks if pObject_ is null. If so, "null" is returned.


contains

public static int contains(java.lang.String sToLookIn_,
                           java.lang.String sThis_)
Deprecated. Well, String.indexOf(String) should be just fine!?

Returns:
-1 if sToLookIn_ does not contain sThis_. Otherwise the position is returned.

compare

public static int compare(java.lang.String firstString,
                          java.lang.String anotherString)
Deprecated. Use String.compare instead.

If you believe it or not, in a very old jdk version there was a bug in String.compareTo(String) and I did need this as a workaround. This method should be of no use anymore [1999-07-15].


indexOfNot

public static int indexOfNot(java.lang.String pString_,
                             char cNot_,
                             int startIndex_)
Returns:
-1 means the string is either "" or contains just the char cNot_.

indexOfNot

public static int indexOfNot(java.lang.String pString_,
                             char cNot_)
Returns:
-1 means the string is either "" or contains just the char cNot_.

count

public static int count(java.lang.String pString_,
                        char c_)
How many chars c_ contains the String pString_.


isDigit

public static boolean isDigit(char c_)
Return true for digit characters.


isVocal

public static boolean isVocal(char c_)
Return true if the given character can be found in the string "aeoui???".


shrinkString

public static java.lang.String shrinkString(java.lang.String pString,
                                            int maxSize)
Reformat a string which is not longer than a given size. If the input string was longer, a piece in the middle of that string will be cut out and replaced with '[...]'. maxSize should be not too small, btw.


concat

public static java.lang.String concat(java.util.Vector pVector_)
This function concatenates different Strings into one String.

Parameters:
pVector_ - Contains the Strings that will be concatenated.
Returns:
There is no 'glue' between the Strings.
See Also:
stringToLines(java.lang.String)

concat

public static java.lang.String concat(java.util.Vector pVector_,
                                      java.lang.String sWith_)
This function concatenates different Strings into one String.

Parameters:
pVector_ - Contains the Strings that will be concatenated.
sWith_ - The 'glue' for the other Strings.
Returns:
sWith_ is not appended at the end.
See Also:
stringToLines(java.lang.String, char)

concat

public static java.lang.String concat(java.util.Vector pVector_,
                                      char cWith_)
This function concatenates different Strings into one String.

Parameters:
pVector_ - Contains the Strings that will be concatenated.
cWith_ - The 'glue' for the other Strings.
Returns:
cWith_ is not appended at the end.
See Also:
stringToLines(java.lang.String, char)

concat

public static java.lang.String concat(java.lang.String pString_,
                                      char cWidth_)
This function concatenates a String with a char.


stringToLines

public static java.util.Vector stringToLines(int lines_,
                                             java.lang.String pString_,
                                             char cCutter_)
This function takes a String and separates it into different lines. The last line does not need to have a separator character.

Parameters:
lines_ - The number of lines that should be extracted. Zero if maximum number of lines is requested.
cCutter_ - The character that separates pString_ into different lines
Returns:
The single lines do not contain the cCutter_ character at the end.

stringToLines

public static java.util.Vector stringToLines(java.lang.String pString_,
                                             char cCutter_)
This function takes a String and separates it into different lines. The last line does not need to have a separator character.

Parameters:
cCutter_ - The character that separates pString_ into different lines
Returns:
The single lines do not contain the cCutter_ character at the end.
See Also:
concat(java.util.Vector, java.lang.String)

stringToLines

public static java.util.Vector stringToLines(java.lang.String pString_)
This function takes a String and separates it into different lines. The last line does not need to have a '\n'. The function can't handle dos carriage returns.

Returns:
The single lines do not contain the '\n' character at the end.

stringToLines

public static java.util.Vector stringToLines(int lines_,
                                             java.lang.String pString_)
This function takes a String and separates it into different lines. The last line does not need to have a '\n'. The function can't handle dos carriage returns.

Parameters:
lines_ - The number of lines that should be extracted. Zero if maximum number of lines is requested.
Returns:
The single lines do not contain the line feed character at the end.
See Also:
concat(java.util.Vector, java.lang.String)

stringToLines

public static java.util.Vector stringToLines(java.lang.String sLines_,
                                             java.lang.String sCutter_)
This function takes a String and separates it into different lines. The last line does not need to have a separator string.

Returns:
Note that the sCutter_ string will be removed from each line.
See Also:
concat(java.util.Vector, java.lang.String)

stringToLines

public static java.util.Vector stringToLines(java.lang.String sLines_,
                                             java.lang.String sTokenizerString_,
                                             boolean bUseTokenizer_)
This function takes a String and separates it into different lines. The last line does not need to have a separator string.

See Also:
concat(java.util.Vector, java.lang.String)

formatBlock

public static java.lang.String formatBlock(java.lang.String pString)
This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned as a block. This method uses a line length of 72.


formatBlock

public static java.lang.String formatBlock(java.lang.String pString,
                                           int lineLength)
This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned as a block.


formatBlock

public static java.lang.String formatBlock(java.lang.String pString,
                                           int lineLength,
                                           int indentation)
This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned as a block.

Parameters:
indentation - add indentation spaces to left of each line.

formatLeft

public static java.lang.String formatLeft(java.lang.String pString)
This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned to the left side. This method uses a line length of 72.


formatLeft

public static java.lang.String formatLeft(java.lang.String pString,
                                          int lineLength)
This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned to the left side.


formatLeft

public static java.lang.String formatLeft(java.lang.String pString,
                                          int lineLength,
                                          int indentation)
This method takes a string and reformats it so that each line has no more than the given length and the text will be aligned to the left side.

Parameters:
indentation - add indentation spaces to left of each line.

formatCenter

public static java.lang.String formatCenter(java.lang.String pString,
                                            int lineLength)
This method takes a string and reformats it so that each line has no more than the given length and the text will be centered in the middle.


centerLine

public static java.lang.String centerLine(java.lang.String pString,
                                          int lineLength)
Returns a string withe the provided content in the center and no line feed. Also, the right side of the string will not be filled up with spaces, only the left side. The input should not contain line feeds, btw.


getDiffPosition

public static int getDiffPosition(java.lang.String s1,
                                  java.lang.String s2)
Finds out the first position (started with 0) at which two strings start to differ.

Parameters:
s1 - a string to compare, is not allowed to be null.
s2 - a string to compare, is not allowed to be null.
Returns:
the first position starting with 0 at which both strings differ or the length of the smaller one or the length of both string if they are equal.

isEmpty

public static boolean isEmpty(java.util.Vector vTest_)
Tests, if a given Vector is null or has size 0.


toVector

public static java.util.Vector toVector(java.util.Enumeration pEnumeration_)
Enumeration to Vector converter.

Returns:
null in empty vector out

objectsToVector

public static java.util.Vector objectsToVector(java.lang.Object[] apObjects)
Convert an array of objects to a vector.


vectorToObjects

public static java.lang.Object[] vectorToObjects(java.util.Vector pVector_)
Convenience class for java.util.Vector.copyInto(..).

Parameters:
pVector_ - the vector to convert into an array.
Returns:
Never returns null, returns at least an array of length 0.

filter

public static java.util.Vector filter(java.util.Vector pVector_,
                                      java.lang.Object oBadElement_)
All object in this vector which equal the bad element are not copied over to the resulting vector.


filter

public static java.util.Vector filter(java.util.Vector pVector_,
                                      java.util.Vector vBadElements_)
All object in this vector which equal an object in the bad vector are not copied over to the resulting vector.


filter

public static java.util.Vector filter(java.util.Vector pVector_,
                                      ccl.util.Testable pFilter_)
Create a new vector and copy all elements of the pVector_ paramter over which are accepted by the test filter.
Each element for which the test returns true, it gets added to the returned vector.


map

public static java.util.Vector map(java.util.Vector pVector_,
                                   ccl.util.Transformable pTransformable_)
Convert each element of the vector by a transformation object.


contains

public static boolean contains(java.util.Vector pVector_,
                               java.lang.String sFind_)
Test if a vector contains a given string.


contains

public static boolean contains(java.util.Vector pVector_,
                               ccl.util.Testable pFilter_)
Test if a vector contains an element which succeeds a given test filter.


enumerationToVector

public static java.util.Vector enumerationToVector(java.util.Enumeration pEnumeration_)
Convert an enumeration to a vector. Sometimes you have an enumeration at hand, which you want to use more than once.


concat

public static java.util.Vector concat(java.util.Vector vFirst_,
                                      java.util.Vector vSecond_)
Create a new vector which consists of both given vectors.


subtract

public static java.util.Vector subtract(java.util.Vector vSource_,
                                        java.util.Vector vToDelete_)
Create a new vector through extracting all elements of the second vector from the first vector.


insert

public static java.util.Vector insert(java.util.Vector vDestination_,
                                      java.util.Vector vOther_,
                                      int destination)
Insert at a special offset all elements of the second vector into the first vector. The input vectors are not changed but a new result vector gets created.


equals

public static boolean equals(java.util.Vector vFirst_,
                             java.util.Vector vSecond_)
Do the elements of two vectors at the same position equal each other?


invert

public static java.util.Vector invert(java.util.Vector vSource_)
Create a new vector and invert the order of the elements.


quickSort

public static void quickSort(java.lang.Object[] s,
                             int lo,
                             int hi,
                             ccl.util.Comparable cmp)
An implementation of Quicksort using medians of 3 for partitions. Used internally by sort. It is public and static so it can be used to sort plain arrays as well. Originally written by Doug Lea and released into the public domain. Thanks for the assistance and support of Sun Microsystems Labs, Agorics Inc, Loral, and everyone contributing, testing, and using this code. History: Date Who What 2Oct95 dl@cs.oswego.edu refactored from DASeq.java 13Oct95 dl Changed protection statuses

Parameters:
s - the array to sort
lo - the least index to sort from
hi - the greatest index
cmp - the comparator to use for comparing elements

quickSort

public static void quickSort(java.util.Vector v,
                             int lo,
                             int hi,
                             ccl.util.Comparable cmp)
An implementation of Quicksort using medians of 3 for partitions. Used internally by sort. It is public and static so it can be used to sort plain arrays as well. Originally written by Doug Lea and released into the public domain. Thanks for the assistance and support of Sun Microsystems Labs, Agorics Inc, Loral, and everyone contributing, testing, and using this code. History: Date Who What 2Oct95 dl@cs.oswego.edu refactored from DASeq.java 13Oct95 dl Changed protection statuses 30Apr97 Clemens.Lahme@gmd.de For use with Vector

Parameters:
v - the vector to sort
lo - the least index to sort from
hi - the greatest index
cmp - the comparator to use for comparing elements

sort

public static java.util.Vector sort(java.util.Vector vInput_,
                                    ccl.util.Comparable pComparable_)
Uses Quicksort using medians of 3 for partitions and the


sortFast

public static void sortFast(java.util.Vector vInput_,
                            ccl.util.Comparable pComparable_)
Like sort but works directly on the input vector.


sort

public static java.util.Vector sort(java.util.Vector pVector_)
Uses Quicksort using medians of 3 for partitions.


sortFast

public static void sortFast(java.util.Vector pVector_)
Uses Quicksort using medians of 3 for partitions.


sort

public static java.util.Vector sort(java.util.Enumeration pEnumeration_)
Quicksort for Enumeration.

Returns:
null in empty vector out

sort

public static java.util.Vector sort(java.util.Enumeration pEnumeration_,
                                    ccl.util.Comparable pComparable_)
Quicksort for Enumeration.

Returns:
null in empty vector out

sortCaseSensitive

public static java.util.Vector sortCaseSensitive(java.util.Vector pVector_)
Case sensitive sort has 'Zorro' ordered before 'arthur'. If that is not desirec, use normal sort routines. Uses Quicksort using medians of 3 for partitions


insert

public static int insert(java.util.Vector pVector_,
                         int lowestOffset_,
                         int highestOffset_,
                         java.lang.Object pObject_,
                         ccl.util.Comparable pComparable_)
Inert a new object into a vector and keep the vector sorted.


insert

public static int insert(java.util.Vector pVector_,
                         java.lang.Object pObject_,
                         ccl.util.Comparable pComparable_)
Inert a new object into a vector and keep the vector sorted.


system

public static java.lang.Process system(java.lang.String sCommand_)
                                throws java.io.IOException
This method does return immediately. If you want the output of the process use either systemAndWait() or systemAndGetError().

Throws:
java.io.IOException - Whatever can go wrong.
See Also:
systemAndWait(java.util.Vector), systemAndGetError(java.util.Vector)

system

public static java.lang.Process system(java.lang.String[] asCommand_)
                                throws java.io.IOException
Execute an external command.

Throws:
java.io.IOException - Whatever Runtime.exec(..) throws.

system

public static java.lang.Process system(java.util.Vector vArgs_)
                                throws java.io.IOException
Execute an external command. Provide arguments inside a vector.

Throws:
java.io.IOException - Whatever Runtime.exec(..) throws.

systemAndWait

public static java.lang.String systemAndWait(java.util.Vector vArgs_)
                                      throws java.io.IOException
Does a system exec and returns the stdout.

Parameters:
vArgs_ - the arguments to system.exec(). Should not be null or empty.
Returns:
The standard output.
Throws:
java.io.IOException - Whatever might go wrong.

systemAndWait

public static java.lang.String systemAndWait(java.lang.String commandline)
                                      throws java.io.IOException
Does a system exec and returns the stdout.

Parameters:
commandline - the arguments to system.exec(). Should not be null or empty.
Returns:
The standard output.
Throws:
java.io.IOException - Whatever might go wrong.

systemAndGetError

public static java.lang.String systemAndGetError(java.util.Vector vArgs_)
                                          throws java.io.IOException
Does a system exec and returns the stderr output.

Parameters:
vArgs_ - the arguments to system.exec(). Should not be null or empty.
Returns:
The standard output.
Throws:
java.io.IOException - Whatever might go wrong.

systemAndGetError

public static java.lang.String systemAndGetError(java.lang.String commandline)
                                          throws java.io.IOException
Does a system exec and returns the stderr output.

Parameters:
commandline - the arguments to system.exec(). Should not be null or empty.
Returns:
The standard output.
Throws:
java.io.IOException - Whatever might go wrong.

isOSWindows

public static boolean isOSWindows()
Returns true if the current operating system is Microsoft Windows.


isOSLinux

public static boolean isOSLinux()
Returns true if the current operating system is Linux.


isOSSolaris

public static boolean isOSSolaris()
Returns true if the current operating system is Sun Microsystem's Solaris (or SunOS).


isOSUnix

public static boolean isOSUnix()
Returns true if the current operating system is either Linux or Solaris.


gc

public static void gc()
System.gc() does not always garanty immediate execution. This method does also a yield for a bigger chance that gc really does happen.


getLocalHostName

public static java.lang.String getLocalHostName()
Get the name of the localhost.


isSwingPackage

public static boolean isSwingPackage(java.lang.String sFullPackageName_)
Returns true if sFullPackageName_ is a swing package, either old com.sun.java.swing or new javax.swing convention. Accessibilitiy is also considered to be a swing package.


getStackTrace

public static java.lang.String getStackTrace(java.lang.Throwable pThrowable_)
Returns a string which contains the stack trace.


getDump

public static java.lang.String getDump(java.lang.Object object_)
This method returns a string with dump out of all its attribute fields, private as well as public fields. Eventually you have to set the security policy in order to permit access to private stuff. This method also fails compiling for jdk 1.1.


rnd

public static boolean rnd()
Returns:
50% chance of either true or false.

rnd

public static int rnd(int end_)
Random number in the range [0, end_] (both inclusive).


rnd

public static int rnd(int start_,
                      int end_)
Random number in the range [start_, end_] (both inclusive).


rnd

public static float rnd(float f)
Returns the a pseudorandom float number between 0.0 and excluding the provided float value.


rnd

public static double rnd(double df)
Returns the a pseudorandom double number between 0.0 and excluding the provided double value.


getStandardDate

public static java.lang.String getStandardDate(java.util.Date pDate_)
Returns:
1998-12-06 for example.

getDate

public static java.lang.String getDate()
Returns the current date as an ISO date string.

Returns:
1998-12-06 for example.

getDate

public static java.lang.String getDate(java.util.Calendar pCalendar_)
Returns the given date as an ISO date string.

Returns:
1998-12-06 for example.

getTime

public static java.lang.String getTime(java.util.Date pDate_)
Returns the time as a string of the given date object.

Returns:
hh:mm:ss

getTime

public static java.lang.String getTime(java.util.Calendar pCalendar_)
Returns:
hh:mm:ss

getTimeWithMillis

public static java.lang.String getTimeWithMillis()
Returns the current time with milli seconds. E.g.: 20:14:59.032

Returns:
current time with milli seconds.

getTimeWithMillis

public static java.lang.String getTimeWithMillis(java.util.Calendar calendar_)
Returns the current time with milli seconds. E.g.: 20:14:59.032

Parameters:
calendar_ - the current time.
Returns:
current time with milli seconds.

getDateTimeAndMillis

public static java.lang.String getDateTimeAndMillis()
Returns a string consiting of the iso date, time, and milli seconds, all concatenated without any space, colon, or dash. E.g. "20000811235959003" representing 2000-08-11 23:59:59.003 . return a string containin only digits repesenting the date and time and milli seconds.


stringToDate

public static java.util.Date stringToDate(java.lang.String sDate_)
Input format of the date is either CCYY-MM-DD or CCYYMMDD. For example: 1999-11-26. Time is undefined and can have every value.

Returns:
null on parse error.

getDate

public static java.util.Calendar getDate(java.lang.String sDate_)
For example: 1999-11-26. Time is undefined and can have every value.

Returns:
null on parse error.

getCalendar

public static java.util.Calendar getCalendar(java.lang.String sTimeZoneID_)
This is a replacement of the SimpleTimeZone.getTimeZone(String) function that additionally creates a GregorianCalendar of the given timezone. There is a new timezone 'CET' (Central European Time. It has the official daylight saving time settings (ranging from the last Sunday in March at 2:00 am to the last Sunday in October at 2:00 am) and should be preferred over 'ECT'.

Parameters:
sTimeZoneID_ - If it is null or "" then "GMT" is used.

getCalendar

public static java.util.Calendar getCalendar()
Returns:
Calendar with local timezone

setTime

public static void setTime(java.util.Calendar pCalendar_,
                           java.lang.String sTime_)
Parameters:
sTime_ - e.g. 23:59:59

setDate

public static void setDate(java.util.Calendar pCalendar_,
                           java.lang.String sDate_)
Parameters:
sDate_ - e.g. 2000-01-26

isDateValid

public static boolean isDateValid(java.lang.String sDate_)
Input format of the date is either CCYY-MM-DD or CCYYMMDD.


getNumberOfDays

public static int getNumberOfDays(java.lang.String sFrom_,
                                  java.lang.String sTo_)
Return the number of days between to dates. The first day and last day are both also counted.


getNextDay

public static java.lang.String getNextDay(java.lang.String sDate_)
Provides the iso date of the next day after the given date.


getLastDayOfMonth

public static java.lang.String getLastDayOfMonth(java.lang.String sDate_)
Provide an iso date string and get back an iso date string with the last day in the same month.


getFirstDayOfMonth

public static java.lang.String getFirstDayOfMonth(java.lang.String sDate_)
Provide an iso date string and get back an iso date string which has the day set to one.


getMonth

public static java.lang.String getMonth(java.lang.String sDate)
Returns the English name of the month of the given iso-date.


getTodaySortable

public static java.lang.String getTodaySortable()
Deprecated. use getDate() instead.


getHeuteSortable

public static java.lang.String getHeuteSortable()
Deprecated.  

See Also:
getTodaySortable()

getConstantObject

public static java.lang.Object getConstantObject()
Sometimes you need a dummy object just to have any value for a hashtable or so and it doesn't matter at all if we always use the same object, so here is one you can use without wasting extra memory.


sleep

public static void sleep(int seconds_)
Current thread sleeps in seconds.


isAlpha

public static boolean isAlpha(char c_)
Checks that a character is of type alpha. This means either the given character is in range a-z or it is a German umlaut (sorry, no other countries are supported right now - please add what you need).

Parameters:
c_ - a character to test for alpha status.
Returns:
true if the input character is of type alpha (A-Za-z or German umlaut).

max

public static long max(long a_,
                       long b_)
Deprecated.  

See Also:
java.lang.Math.max

max

public static int max(int a_,
                      int b_)
Deprecated.  

See Also:
java.lang.Math.max

min

public static int min(int a_,
                      int b_)
Deprecated.  

See Also:
java.lang.Math.min

swap

public static java.lang.Object swap(java.lang.Object objFirst,
                                    java.lang.Object objSecond)
This method is the first part of a service to swap two objects in less than 3 steps. Normally if you swap two objects you need 3 statements.
c = a; a = b; b = c;
Using this method plus method swap() you can get away with only two statements in your code.

For example:
o1 = swap(o1, o2); o2 = swap();

Returns:
the second input parameter object.
See Also:
swap

swap

public static java.lang.Object swap()
This method is the second step of a service to swap two objects in less than 3 steps. Normally if you swap two objects you need 3 statements.
c = a; a = b; b = c;
Using this method plus method swap() you can get away with only two statements in your code.

Note that this method will keep a reference to the first object until the swap method pair will be used again with a new pair of parameters!!!

Returns:
the first input parameter object from a previous swap(Object, Object) invocation.
See Also:
swap

swapInt

public static int swapInt(int first,
                          int second)
This method is the first part of a service to swap two int values in less than 3 steps. Normally if you swap two objects you need 3 statements.
c = a; a = b; b = c;
Using this method plus method swap() you can get away with only two statements in your code.

Returns:
the second input parameter object.
See Also:
swapInt

swapInt

public static int swapInt()
This method is the second step of a service to swap two int values in less than 3 steps. Normally if you swap two objects you need 3 statements.
c = a; a = b; b = c;
Using this method plus method swap() you can get away with only two statements in your code.

Returns:
the first input parameter object from a previous swap(Object, Object) invocation.
See Also:
swapInt

getObjectName

public static java.lang.String getObjectName(java.lang.Object pObject_)
pObject_.getClass().getName() returns the name including its package. This method returns just the name without its package.


getUsedMemory

public static long getUsedMemory()
This method returns the memory currently in use.


getUsedMemoryPercentage

public static java.lang.String getUsedMemoryPercentage()
This method returns the percentage of used memory.


getUsedMemoryPercentage

public static java.lang.String getUsedMemoryPercentage(long used,
                                                       long total)
This method returns the percentage of used memory.


formatMemoryInfo

public static java.lang.String formatMemoryInfo()
Returns a message which has nicely formatted information about the current memory usage.