mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-24 04:54:21 +08:00
style: enable ParameterName
in CheckStyle. (#5196)
* Enabled: ParameterName in CheckStyle. * Refactored to fix bug caused by selfAssignment of variables in VectorCrossproduct class
This commit is contained in:

committed by
GitHub

parent
2568b96784
commit
c42b1c940c
@ -39,17 +39,17 @@ public final class KMP {
|
||||
}
|
||||
|
||||
// return the prefix function
|
||||
private static int[] computePrefixFunction(final String P) {
|
||||
final int n = P.length();
|
||||
private static int[] computePrefixFunction(final String p) {
|
||||
final int n = p.length();
|
||||
final int[] pi = new int[n];
|
||||
pi[0] = 0;
|
||||
int q = 0;
|
||||
for (int i = 1; i < n; i++) {
|
||||
while (q > 0 && P.charAt(q) != P.charAt(i)) {
|
||||
while (q > 0 && p.charAt(q) != p.charAt(i)) {
|
||||
q = pi[q - 1];
|
||||
}
|
||||
|
||||
if (P.charAt(q) == P.charAt(i)) {
|
||||
if (p.charAt(q) == p.charAt(i)) {
|
||||
q++;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ final class PasswordGen {
|
||||
private PasswordGen() {
|
||||
}
|
||||
|
||||
static String generatePassword(int min_length, int max_length) {
|
||||
static String generatePassword(int minLength, int maxLength) {
|
||||
Random random = new Random();
|
||||
|
||||
String upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
@ -35,7 +35,7 @@ final class PasswordGen {
|
||||
StringBuilder password = new StringBuilder();
|
||||
|
||||
// Note that size of the password is also random
|
||||
for (int i = random.nextInt(max_length - min_length) + min_length; i > 0; --i) {
|
||||
for (int i = random.nextInt(maxLength - minLength) + minLength; i > 0; --i) {
|
||||
password.append(letters.get(random.nextInt(letters.size())));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user