Class RandomStringFactory


  • public final class RandomStringFactory
    extends java.lang.Object
    A factory for creating random String objects
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String newRandomLongString​(long length)
      Generates a random string.
      static java.lang.String newRandomLongString​(java.lang.String chars, long length)
      The Method randomString(String, long) makes an random String from the given String and to the specified length.
      static java.lang.String newRandomString()
      Generates a random string with a length between 3 and 25
      static java.lang.String newRandomString​(int length)
      Generates a random string.
      static java.lang.String newRandomString​(int start, int end)
      Generates a random string with a length between the given start and end
      static java.lang.String newRandomString​(java.lang.String[] array)
      The Method randomString(String []) a random String from the Array For example: The Stringarray test as argument.
      static java.lang.String newRandomString​(java.lang.String chars, int length)
      The Method randomString(String, int) makes an random String from the given String and to the specified length.
      static java.lang.String randomHexString​(int numberOfCharacters)
      Generates a random hexadecimal String
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • newRandomString

        public static java.lang.String newRandomString()
        Generates a random string with a length between 3 and 25
        Returns:
        The produced random String.
      • newRandomString

        public static java.lang.String newRandomString​(int length)
        Generates a random string.
        Parameters:
        length - the specified length.
        Returns:
        the generated random string.
      • newRandomLongString

        public static java.lang.String newRandomLongString​(long length)
        Generates a random string.
        Parameters:
        length - the specified length.
        Returns:
        the generated random string.
      • newRandomString

        public static java.lang.String newRandomString​(int start,
                                                       int end)
        Generates a random string with a length between the given start and end
        Parameters:
        start - the start
        end - the end
        Returns:
        the generated random string
      • newRandomString

        public static java.lang.String newRandomString​(java.lang.String chars,
                                                       int length)
        The Method randomString(String, int) makes an random String from the given String and to the specified length. This can be used to produce passwords.
        Parameters:
        chars - The String to get the random chars.
        length - The length from the random String.
        Returns:
        The produced random String.
      • newRandomLongString

        public static java.lang.String newRandomLongString​(java.lang.String chars,
                                                           long length)
        The Method randomString(String, long) makes an random String from the given String and to the specified length. This can be used to produce passwords.
        Parameters:
        chars - The String to get the random chars.
        length - The length from the random String.
        Returns:
        The produced random String.
      • newRandomString

        public static java.lang.String newRandomString​(java.lang.String[] array)
        The Method randomString(String []) a random String from the Array For example: The Stringarray test as argument. Possible values: "blab", "flih", "klap", "teta", "brut", "gzft", "ccp". Possible selection can be one value from the Stringarray like "blab" or "klap".
        Parameters:
        array - The array with the String to be selected.
        Returns:
        The selected String from the array.
      • randomHexString

        public static java.lang.String randomHexString​(int numberOfCharacters)
        Generates a random hexadecimal String
        Parameters:
        numberOfCharacters - the number of characters
        Returns:
        the generated random hexadecimal String