//I am passing a hex as a string into a decimal integer and I know Integer.parseInt() is easier but i can not use it.
//Look below two areas have illegal start of expression and one with not a statement.
public class HexToDecimal
{
public static void main (String [] args)
{
int total=0;
total=parseHex("ABC");
System.out.println("Hex String ABC = Decimal:"+total);
}
public static int parseHex(String hex)
{
int decValue;
int length=hex.length();
int total;
for (int i=0;i<length;i++)
{
decValue=getValue(hex.CharAt(i));
total= total +(int)(decValue*(Math.pow(16, length-1-)));//illegal start of expression
}
return total;
}
public static int getValue(char c)
{
int hold;
switch (c)
{
case:('0'); //illegal start of expression and not a statement
hold=0;
break;
}
}
}