package pwc.taxtech.atms.common; import org.apache.commons.text.RandomStringGenerator; import org.springframework.stereotype.Component; /** @see PwC.Tax.Tech.Atms.Application.Base\Utils\StringHelper.cs */ @Component public class StringHelper { private static RandomStringGenerator randomStringGenerator; static { RandomStringGenerator.Builder builder = new RandomStringGenerator.Builder(); char[][] array = { { 'a', 'z' }, { 'A', 'Z' }, { '0', '9' } }; builder.withinRange(array); randomStringGenerator = builder.build(); } public String generateRandomPassword() { return randomStringGenerator.generate(9); } }