title: using user input to convert hex (0x) or binary (0b) to decimal numbers
body: <p>user enters a number in either hex or binary (must be prefixed with 0x or 0b, if not gives the error message). 
  read user input as a string</p>
  
  <p>i can't use radix, i'm just using integer.parseInt(s) </p>
  
  <p>i am not sure how to make this program work.. please help
  what am i missing here?</p>
  
  <pre><code>import java.util.Scanner;
  public class conversion {
  
  public static void main(String[] args) {
  
      Scanner input = new Scanner(System.in);
  
      //ask user to enter either hex or binary
      System.out.println("Please enter a hex (0x) or binary (0b) number: ");
  
      //read input as string
      String hexString = input.nextLine();
      String binString = input.nextLine();
  
  
      //if prefix (0x)
      if ((hexString.substring(0,2)).equals("0x")) {
          int hex = Integer.parseInt(hexString, 16);
          System.out.println("Converting from base-16 to base-10.\n" + hex);
  
          //if there are no digits or invalid digits after Ox
          //if ((hexString.substring(beginIndex))) {
          //  System.out.println("Error parsing base-16 number");
          //}
  
      //if prefix (0b)    
      } else if ((binString.substring(0,2)).equals("0b")) {
          int bin = Integer.parseInt(binString, 2);
          System.out.println("Converting from base-2 to base-10.\n" + bin);
  
          //if there are no digits or invalid digits after Ob
          //if ((binString.substring(beginIndex))) {
          //  System.out.println("Error parsing base-2 number");
          //}
  
  
      } else {
          System.out.println("I don't know how to covert that number");
      }
  </code></pre>