title: Dusting off rust of Programming and Logic
body: <p>So I am working on a homework assignment for a Programming and Logic class II. I did well in the first class but that happened to be about 3 semesters ago and a different teacher. I am beyond lost on this first assignment. Any help would be great as to what I am missing.</p>
  
  <p>Write a Java program to demonstrate using command line arguments to convert numeric quantities with a certain radix (counting base) to base ten numbers. You will employ the use of String methods indexOf() and substring() as well as the Integer method parseInt().</p>
  
  <p>The strings in args will be the form “value:radix” where value is expressed with digits appropriate to the radix.</p>
  
  <p>So “16384:10” is 16384 as a base 10 number.
  Use indexOf() to find the colon and gather the number and the radix using substring(). These values can be used to make a call to parseInt() to convert the numbers to base 10.</p>
  
  <p>If the provided command line arguments were:
  4eb:16 10110110:2 407:8 2048:10 </p>
  
  <p>Output should be similar to:
  4eb base 16 is 1259 base 10 10110110 base 2 is 182 base 10 407 base 8 is 263 base 10 2048 base 10 is 2048 base 10</p>
  
  <p>So what I have so far. Compiles but cant get it to take the args and I know I am not getting the parseint right or radix I think.</p>
  
  <pre><code>public class D1 {
  public static void main(String[] args) 
  { int x, col; String number, radix;
  
  for (x=0; x &lt; args.length; x++) {
    col = args[x].indexOf(":");
    number = args[x].substring(0,col);
    radix = args[x].substring(col + 1);
    int base1 = Integer.parseInt(number, 16);
    System.out.println( number + " base " + radix + " is " + base1 + " base 10"); }
  } }
  </code></pre>