title: Recursion: Binary to Decimal
body: <p>I am working on a recursive method that takes a binary number as a string and displays its decimal equivalent. I am unsure if my base cases are correct. Also, am I properly imposing recursion within the method? </p>
  
  <pre><code>public  static void main(String[] args){
      System.out.println("Enter a binary string ");
      String binary = input.nextLine(); 
  
      System.out.println("The decimal equivalent of " + binary + " is "+ binary2Decimal(binary));
  }
  
  //MethodOverloading
  public static int binary2Decimal(String binary){
      return binary2Decimal(binary,0, binary.length()-1);
      }
  public static void binary2Decimal(String binary, int low, int high){
          int temp=0;
          if(binary.charAt(high) == 0)
              temp *= 2;
          else if(binary.charAt(high) == 1)
              temp = (temp * 2) + 1;
          return binary2Decimal(binary,low,high -1)+temp;
  
      }
  }
  </code></pre>