Class Utils


  • public class Utils
    extends java.lang.Object
    this class represent all sorts of utility functions i need
    Author:
    Juan Manuel Spoleti
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String convertDateToFormatMMDDYYYY​(java.util.Date date)  
      static java.lang.String dateToString​(java.time.LocalDate date, java.lang.String dateFormat)  
      static void deleteFileIfExists​(java.lang.String filePath)  
      static int getOnlyNumbersFromString​(java.lang.String stringToReplace)  
      static java.lang.String getRandom​(int amount, boolean letters, boolean numbers)  
      static java.lang.String getRandomLetters​(int amount)  
      static java.lang.String getRandomNumber​(int amount)
      Method that generates a random number
      static <T> java.util.List<T> parseArrayToList​(T[] array)  
      static java.lang.String removeFirstAndLastChar​(java.lang.String text)  
      static java.math.BigDecimal replaceDollarWithNumber​(java.lang.String value)
      Method that replace a string containing the dollar (US$) symbol and some spaces from the keyboard
      static java.time.LocalDate stringToDate​(java.lang.String date, java.lang.String dateFormat)  
      • Methods inherited from class java.lang.Object

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

      • Utils

        public Utils()
    • Method Detail

      • getRandomNumber

        public static java.lang.String getRandomNumber​(int amount)
        Method that generates a random number
        Parameters:
        amount - of random that i want
        Returns:
        random number
      • getRandomLetters

        public static java.lang.String getRandomLetters​(int amount)
      • getRandom

        public static java.lang.String getRandom​(int amount,
                                                 boolean letters,
                                                 boolean numbers)
      • removeFirstAndLastChar

        public static java.lang.String removeFirstAndLastChar​(java.lang.String text)
      • replaceDollarWithNumber

        public static java.math.BigDecimal replaceDollarWithNumber​(java.lang.String value)
        Method that replace a string containing the dollar (US$) symbol and some spaces from the keyboard
        Parameters:
        value -
        Returns:
        new value of the string in BigDecimal
      • dateToString

        public static java.lang.String dateToString​(java.time.LocalDate date,
                                                    java.lang.String dateFormat)
        Parameters:
        date -
        dateFormat -
        Returns:
        LocalDate parsed to String
      • stringToDate

        public static java.time.LocalDate stringToDate​(java.lang.String date,
                                                       java.lang.String dateFormat)
        Parameters:
        date -
        dateFormat -
        Returns:
        String parsed to LocalDate
      • convertDateToFormatMMDDYYYY

        public static java.lang.String convertDateToFormatMMDDYYYY​(java.util.Date date)
      • getOnlyNumbersFromString

        public static int getOnlyNumbersFromString​(java.lang.String stringToReplace)
      • deleteFileIfExists

        public static void deleteFileIfExists​(java.lang.String filePath)
      • parseArrayToList

        public static <T> java.util.List<T> parseArrayToList​(T[] array)