error while trying .charAt( )
here is the portion of my program that matters. all the variables have been declared already so just go with that. The point of this program is to read in a binary number (like 010011) and then 1) check that is actually binary 2) convert to decimal.
In this part of the code I want it to read in a string, and then read out a specific character so that I can examine it with a if ( ) statement to see if it is a 0 or a 1.
Now I get a exception error everytime I run and I know it is from the charAt part because I dont have a normal intiger inside the ( ).
String binaryNumber;
int numberOfDigets = 1;
char specificCharacter;
Scanner scan = new Scanner(System.in);
System.out.println("Input a valid binary number.");
binaryNumber = scan.next();
numberOfDigets = binaryNumber.length();
specificCharacter = binaryNumber.charAt( numberOfDigets );
System.out.println(specificCharacter);
if you have any idea how i can get this to work or why it isnt I need all the help I can get
p.s. if you need more clarification on what I am doing /going to do I will tell all :P

