Given an int see if its characters were from smallest to largest and return true or false, you could only take an if, without strings, or ternary operator, or cycles: * ME COULD ME SAY HOW TO IMPROVE MY CODE KNOWING WHAT I SAID
private boolean funcion(int numero) {
int modulo = Math.abs(number % 10);
number = number / 10;
if (modulo > (number % 10)) {
return funcion(number);
}
return (number == 0) ? true : false;
}
Aucun commentaire:
Enregistrer un commentaire