Update HexaDecimalToDecimal.java

This commit is contained in:
khaireddine mejri 2018-05-19 16:20:35 +02:00 committed by GitHub
parent 00736054bc
commit d5c673aa97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,8 +11,7 @@ public class HexaDecimalToDecimal {
int val = 0; int val = 0;
for (int i = 0; i < hex.length(); i++) for (int i = 0; i < hex.length(); i++)
{ {
char c = hex.charAt(i); int d = digits.indexOf(hex.charAt(i));
int d = digits.indexOf(c);
val = 16*val + d; val = 16*val + d;
} }
return val; return val;