lundi 15 juillet 2019

how covert octal to decimal with if-else

for (int charIndex = 0; charIndex < octStrLen; charIndex++) {
     char hexChar = octString.charAt(charIndex);

    int expFactor =(int)Math.pow(8,octStrLen -1 - charIndex);
    if (hexChar >= '0' && hexChar <= '7'){
        dec = (hexChar * expFactor) +dec;

Aucun commentaire:

Enregistrer un commentaire