generate 5 digit random string in java
RandomStringUtils.randomAlphanumeric(17).toUpperCase()
generate 5 digit random string in java
RandomStringUtils.randomAlphanumeric(17).toUpperCase()
java 8 random string generator
@Test
public void givenUsingJava8_whenGeneratingRandomAlphanumericString_thenCorrect() {
int leftLimit = 48; // numeral '0'
int rightLimit = 122; // letter 'z'
int targetStringLength = 10;
Random random = new Random();
String generatedString = random.ints(leftLimit, rightLimit + 1)
.filter(i -> (i <= 57 || i >= 65) && (i <= 90 || i >= 97))
.limit(targetStringLength)
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
.toString();
System.out.println(generatedString);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us