// Default is found
boolean isFound = true;
- long part1 = 0;
- long part2 = 0;
+
+ // Declare variables
+ long part1;
+ long part2;
// Is the number used?
while (isFound) {
// Both number parts
- part1 = Math.round(Math.random() * 100000);
- part2 = Math.round(Math.random() * 1000);
+ part1 = Math.round(Math.random() * 100_000);
+ part2 = Math.round(Math.random() * 1_000);
// Generate new number
customerNumber = String.format("%s-%s", part1, part2); //NOI18N
// Is the number used?
while (isFound) {
// Both number parts
- String randString = String.format("%s:%s:%s", Long.toHexString(Math.round(Math.random() * 1000000)), em, customer.getCustomerNumber());
+ String randString = String.format("%s:%s:%s", Long.toHexString(Math.round(Math.random() * 1_000_000)), em, customer.getCustomerNumber());
// Generate access key, use SHA512 hashing and BASE64-encoding for strong key generation
accessKey = Base64.encodeBase64String(Sha2Crypt.sha512Crypt(randString.getBytes()).getBytes()).substring(0, 100);