Class Utility

java.lang.Object
marauroa.common.Utility

public class Utility extends Object
Some generic utility methods.
Author:
Matthias Totz
  • Method Details

    • addLeadingZeros

      public static String addLeadingZeros(String number, int maxDigits)
      adds some leading '0' to the sting until the length maxDigits is reached
      Parameters:
      number - the number to convert
      maxDigits - the amount of digits expected
      Returns:
      the expected number
    • dumpByteArray

      public static String dumpByteArray(byte[] byteArray)
      creates a nice hex-dump of the byte array
      Parameters:
      byteArray - the byte array to convert.
      Returns:
      a hex-dump of the array.
    • dumpInputStream

      public static String dumpInputStream(InputStream byteStream)
      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

      public static String[] copy(String[] array)
      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