Try initializing a char to the char value returned by charAt()
char current = hex.charAt(i);
Then in your conditional use the literal char:
else if (current == 'b')
Since char is a primitive you can compare it using the == operator. In the former code you were comparing a String using ==, since a String is an Object the code is checking to see if they are the same Object not if they have the same value as the String.equals() method would.