private int rdHexDigit(){
  int b=0;
  try {
    b=buffIn.read();
    if ((b >= '0') && (b <= '9')) {
      b=b - '0';
    }
 else     if ((b >= 'A') && (b <= 'F')) {
      b=b - 'A' + 10;
    }
 else     if ((b >= 'a') && (b <= 'f')) {
      b=b - 'a' + 10;
    }
 else {
      JOptionPane.showMessageDialog(this,"Invalid hex digit at line " + lineNo,"Hex File",JOptionPane.ERROR_MESSAGE);
      log.error("Format Error! Invalid hex digit at line " + lineNo);
      b=16;
    }
  }
 catch (  IOException e) {
    JOptionPane.showMessageDialog(this,"I/O Error reading hex file!","Hex File",JOptionPane.ERROR_MESSAGE);
    log.error("I/O Error reading hex file!" + e.toString());
  }
  return (byte)b;
}

private int rdHexDigit ( ) { int b = 0 ; try { b = buffIn . read ( ) ; if ( ( b >= '0' ) && ( b <= '9' ) ) { b = b - '0' ; } else if ( ( b >= 'A' ) && ( b <= 'F' ) ) { b = b - 'A' + 10 ; } else if ( ( b >= 'a' ) && ( b <= 'f' ) ) { b = b - 'a' + 10 ; } else { JOptionPane . showMessageDialog ( this , "Invalid hex digit at line " + lineNo , "Hex File" , JOptionPane . ERROR_MESSAGE ) ; log . error ( "Format Error! Invalid hex digit at line " + lineNo ) ; b = 16 ; } } catch ( IOException e ) { JOptionPane . showMessageDialog ( this , "I/O Error reading hex file!" , "Hex File" , JOptionPane . ERROR_MESSAGE ) ; log . error ( "I/O Error reading hex file!" + e . toString ( ) ) ; } return ( byte ) b ; }
read a single hex digit . returns 16 if digit is invalid
