Package marauroa.common
Class Utility
java.lang.Object
marauroa.common.Utility
Some generic utility methods.
- Author:
- Matthias Totz
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddLeadingZeros(String number, int maxDigits)adds some leading '0' to the sting until the length maxDigits is reachedstatic byte[]copy(byte[] array)copies an arraystatic float[]copy(float[] array)copies an arraystatic String[]copies an arraystatic StringdumpByteArray(byte[] byteArray)creates a nice hex-dump of the byte arraystatic StringdumpInputStream(InputStream byteStream)creates a nice hex-dump of the byte arraystatic voidsleep(int ms)Sleeps a number of milliseconds.
-
Method Details
-
addLeadingZeros
adds some leading '0' to the sting until the length maxDigits is reached- Parameters:
number- the number to convertmaxDigits- the amount of digits expected- Returns:
- the expected number
-
dumpByteArray
creates a nice hex-dump of the byte array- Parameters:
byteArray- the byte array to convert.- Returns:
- a hex-dump of the array.
-
dumpInputStream
creates a nice hex-dump of the byte array- Parameters:
byteStream- the byte array to convert.- Returns:
- a hex-dump of the array.
-
copy
public static byte[] copy(byte[] array)copies an array- Parameters:
array- array to copy- Returns:
- copy of array
-
copy
public static float[] copy(float[] array)copies an array- Parameters:
array- array to copy- Returns:
- copy of array
-
copy
copies an array- Parameters:
array- array to copy- Returns:
- copy of array
-
sleep
public static void sleep(int ms)Sleeps a number of milliseconds.- Parameters:
ms- number of milliseconds to sleep
-