title: How to make an 8 bit Binary Calculator
body: <p>So I made an 8-bit binary calculator but I kinda cheated with the following methods. </p>
  
  <pre><code>  public static int[] convertToBinary(int b){
      String toStr = Integer.toBinaryString(b);
      String fStr = ("00000000"+toStr).substring(toStr.length());
      String[] array = fStr.split("");
      int[] finalArray = new int[array.length-1]; 
      for(int i = 0; i &lt; finalArray.length; i++){
        finalArray[i] = Integer.parseInt(array[i+1]);
      }
  
      return finalArray;
    }
  
  
    public static int[] addBin(int a[], int b[]){
      int[] added = new int[a.length];
      for(int i = added.length - 1; i &gt;= 0; i--){
        if((a[i]+b[i] &gt; 1)){
          System.out.println("Error: overflow");
          break;
        }else{
          added[i] = (a[i]+b[i]);
        }
      }
      return added;
    }
  </code></pre>
  
  <p>My question is how do I convert an int to binary and how do I add two binary numbers.</p>