Commentaire de code
bifaka
-
Utilisateur anonyme -
Utilisateur anonyme -
merci de vouloir bien m'aider. Peux tu commenter ton algorithme?
Si ca ne te gene pas, j'aimerai avoir ton adresse internet pour directement de poser la question si j'en ai une. Je te trouve génial.
voici la mienne: domancini@yahoo.fr
Bonne journée à toi.
public class Converter {
public static long hexToDec(String hex) {
long n = 0;
for (int i = 0; i < hex.length(); i++) {
char charHex = hex.charAt(i);
int exponent = hex.length() - (i + 1);
long mult = (long)Math.pow(16, exponent);
if (charHex >= 65) {
n += (charHex - 55) * mult;
} else {
n += (charHex-48) * mult;
}
}
return n;
}
public static void main(String[] args) {
System.out.println(Converter.hexToDec("AAA"));
}
}
Si ca ne te gene pas, j'aimerai avoir ton adresse internet pour directement de poser la question si j'en ai une. Je te trouve génial.
voici la mienne: domancini@yahoo.fr
Bonne journée à toi.
public class Converter {
public static long hexToDec(String hex) {
long n = 0;
for (int i = 0; i < hex.length(); i++) {
char charHex = hex.charAt(i);
int exponent = hex.length() - (i + 1);
long mult = (long)Math.pow(16, exponent);
if (charHex >= 65) {
n += (charHex - 55) * mult;
} else {
n += (charHex-48) * mult;
}
}
return n;
}
public static void main(String[] args) {
System.out.println(Converter.hexToDec("AAA"));
}
}
A voir également:
- Commentaire de code
- Code ascii - Guide
- Code de déverrouillage oublié - Guide
- Code puk bloqué - Guide
- Code activation windows 10 - Guide
- Commentaire word - Guide