H
Heyoka955
Gast
hallo leute ich habe eine frage wieso bekomme ich den Code nicht hin ,ich habe den pseudo Code in Java übersetzt aber der scheitert bei 8 Tests und 5 hat er richtig.


Java:
public class Validate{
public static boolean validate(String n){
int sum = 0;
int laenge = n.length();
int parity = laenge % 2;
for(int i = 0; i < laenge; i++){
int result = Integer.parseInt(n);
if( i % 2 == parity){
result *= 2;
if(result > 9){
result = result - 9;
}
sum += result;
}
}
return (sum % 10) == 0;
}
}