/**Base conversion program that takes a starting base via args[0] and a number in
that starting base via standard input, and converts it into base ten. */
public class ToDecimal {

   /**Gets the data, calls the baseConverter, outputs the base ten number. */
   public static void main(String[] args) throws java.io.IOException {
      
      //takes input from the standard input system
      java.io.BufferedReader keyboard
         = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
      
      String s = keyboard.readLine();
      
      if (args.length == 0 || !(Character.isDigit(args[0].charAt(0)))){ 
         throw new IllegalArgumentException("no valid starting base given");
      }
      
      if (s.indexOf('[') == -1) {
         throw new IllegalArgumentException("invalid standard input");
      }
      
      //converts args[0] to an int which is the starting base 
      final int STARTING_BASE = Integer.parseInt(args[0]);

      //creates a string of the original number from standard input
      //by removing the outside brackets from it
      String noBrackets = s.substring(1, s.length() - 1);
      
      //takes out the brackets, replacing "][" with " "
      for (int i = 0; i < noBrackets.length() - 1; i++) {
         if (noBrackets.charAt(i) == ']' && noBrackets.charAt(i + 1) == '[') {
            noBrackets = noBrackets.substring(0, i) + ' ' 
               + noBrackets.substring(i + 2);
         }
      }
      
      for (int i = 0; i < noBrackets.length(); i++) {
         if (!(Character.isDigit(noBrackets.charAt(i))) &&
            (!(Character.isSpaceChar(noBrackets.charAt(i))))) {
            throw new IllegalArgumentException("invalid standard input");
         }
      }     

      String[] strArray = noBrackets.split(" ");
      
      for (int i = 0; i < strArray.length; i++) {
         if (STARTING_BASE <= Integer.parseInt(strArray[i])) {
            throw new IllegalArgumentException("digit not allowed to be greater than base");
         }
      }
      
      int[] a = new int[strArray.length];
      
      for (int i = 0; i < a.length; i++) {
         a[i] = Integer.parseInt(strArray[i]);
      }
      
      //converts the number from the starting base to its decimal form and
      //prints out the converted answer, a number in decimal form (base ten)
      System.out.println(convertToDecimal(STARTING_BASE, a));
   }
   
   //method that takes in a starting base and an integer array that represents
   //the original number in the starting base, converts that number into base ten,
   //and returns the base ten number
   public static int convertToDecimal(int startingBase, int[] array) {
      int convertedNumber = array[0];
      for (int i = 0; i < array.length - 1; i++) {
         convertedNumber = (convertedNumber * startingBase) + array[i + 1];
      }
      return convertedNumber; 
   }
}

@@ -323,23 +323,17 @@
 ption %7B%0A
-      
 %0A
+
       //
@@ -496,23 +496,17 @@
 m.in));%0A
-      
 %0A
+
       St
@@ -535,22 +535,16 @@
 Line();%0A
-      
 %0A      i
@@ -566,54 +566,11 @@
 == 0
- %7C%7C !(Character.isDigit(args%5B0%5D.charAt(0))))%7B 
+) %7B
 %0A   
@@ -643,38 +643,235 @@
 iven%22);%0A      %7D%0A
+%0A
       
+for (int i = 0; i %3C args%5B0%5D.length(); i++) %7B%0A        if (!(Character.isDigit(args%5B0%5D.charAt(i)))) %7B%0A          throw new IllegalArgumentException(%22no valid starting base given%22);%0A        %7D%0A      %7D%0A
 %0A      if (s.ind
@@ -960,38 +960,32 @@
 nput%22);%0A      %7D%0A
-      
 %0A      //convert
@@ -1030,17 +1030,16 @@
 ing base
- 
 %0A      f
@@ -1266,23 +1266,17 @@
 ) - 1);%0A
-      
 %0A
+
       //
@@ -1517,17 +1517,16 @@
 i) + ' '
- 
 %0A       
@@ -1579,31 +1579,25 @@
   %7D%0A      %7D%0A
-      
 %0A
+
       for (i
@@ -1853,21 +1853,16 @@
 %0A      %7D
-     
 %0A%0A      
@@ -1904,23 +1904,17 @@
 t(%22 %22);%0A
-      
 %0A
+
       fo
@@ -2126,31 +2126,25 @@
   %7D%0A      %7D%0A
-      
 %0A
+
       int%5B%5D 
@@ -2173,23 +2173,17 @@
 ength%5D;%0A
-      
 %0A
+
       fo
@@ -2276,15 +2276,9 @@
   %7D%0A
-      
 %0A
+
     
@@ -2496,12 +2496,9 @@
   %7D%0A
-   
 %0A
+
    /
@@ -2969,13 +2969,16 @@
 ber;
- 
 %0A   %7D%0A
+   %0A
 %7D%0A

fix exceptions