Hex to Decimal

Write a method that parses a hex number as a string into a decimalinteger. The method header is as follows:
public static int parseHex(String hexString);
For example, hex string 0xA5 is 165 (10 * 16^1 + 5 * 16^0 = 165) and0xFAA is 4010 (15 * 16^2 + 10 * 16^1 + 10 * 16^0 = 4010). SoparseHex("A5") returns 165 and parseHex("FAA") returns 4010. Usehex strings 0xABC and 0x10A to test the method. Note thatInteger.parseInt("FAA", 16) parses a hex string to a decimal value. Donot use this method in this exercise.
Powered by