Class Util


  • public final class Util
    extends Object
    Utility methods collection
    • Field Detail

      • ZERO_LENGTH_CHARACTER_ARRAY

        public static final Character[] ZERO_LENGTH_CHARACTER_ARRAY
      • BIG_INTEGER_TWO

        public static final BigInteger BIG_INTEGER_TWO
    • Method Detail

      • repeat_char

        public static String repeat_char​(char c,
                                         int times)
        Repeats text multiple times
        Parameters:
        c - character to repeat
        times - number of times. Values less or equal to zero will result in empty string
        Returns:
        text repeated multiple times
      • randomlyChangeCase

        public static String randomlyChangeCase​(Random rnd,
                                                CharSequence input)
        Randomly change case for the letters in a string
        Parameters:
        rnd - random to be used
        input - input string to randomize
        Returns:
        string with random characters changed case.
      • countCaseInsensitiveVariations

        public static BigInteger countCaseInsensitiveVariations​(CharSequence value)
        Count number of variation of words in case insensitive manner. For example for word "a" - there are 2 variation ("a" and "A"). For word "1a" - there are also 2 variations ("1a" and "1A") For word "AB" - there are 4 variations: ("ab", "aB", "Ab", "BB")
        Parameters:
        value - word to calculate variations
        Returns:
        number of variations.
      • indexOfNextCaseSensitiveCharacter

        public static OptionalInt indexOfNextCaseSensitiveCharacter​(CharSequence text,
                                                                    int startIndex)
        Finds next case sensitive character. Case sensitive character is either lower-case or upper-case character.
        Parameters:
        text - text to be analyzed
        startIndex - start search from index.
        Returns:
        index of next case sensitive character or empty if no such character present