Binary Addition Seed

import java.util.*;

public class BinaryAddition {
    static Scanner sc = new Scanner(System.in);
    
    public static int inputBinary (String prompt) {
        System.out.print(prompt);
        int deciOne = sc.nextInt();
        System.out.println(deciOne);
        int binOne = 0;
        for (int i = 10; i>=0; i--) {
            binOne += (int)((deciOne % Math.pow(10,i+1)) / Math.pow(10,i)) * (Math.pow(2,i)); 
        }
        return binOne;
    }
    
    public static String addBin (int numOne, int numTwo) {
        String sum = "";
        int carryOver = 0;
        for (int i = 0; i<=33; i++) {
            int first = numOne % 2;
            int second = numTwo % 2;
            if (first + second + carryOver > 1) { 
                sum = (char)('0' + (first + second + carryOver - 2)) + sum;
                carryOver = 1; 
            }
            else {
                sum = Integer.toString(first + second + carryOver) + sum;
                carryOver = 0; 
            }
            numOne = numOne >> 1;
            numTwo = numTwo >> 1;
        }
        
        // cut string
        while (sum.charAt(0) == '0' && sum.length() > 1) {
            sum = sum.substring(1, sum.length());
        }
        
        return sum;
    }
    
    public static void main (String[] args) {
        int numOne = inputBinary("Input first binary number: ");
        int numTwo = inputBinary("Input second binary number: ");
        String sum = addBin(numOne, numTwo);
        System.out.println("The sum is: " + sum);
    }
}

BinaryAddition.main(null);
Input first binary number: 1
Input second binary number: 1
The sum is: 10

int/Integer

void swap (int a, int b) {
  int temp = a;
  a = b;
  b = temp;
}

int a = (int)(Math.random()*100);
int b = (int)(Math.random()*100);
System.out.println("a = " + a + " and " + "b = " + b);

swap(a, b);
// values stay the same
System.out.println("a = " + a + " and " + "b = " + b);

int c = a + b;
System.out.println("c = " + c);
a = 85 and b = 90
a = 85 and b = 90
c = 175
void swap (Integer a, Integer b) {
  Integer temp = a;
  a = b;
  b = temp;
}

Integer a = new Integer((int)(Math.random()*100));
Integer b = (int)(Math.random()*100);
ArrayList<Integer> arr = new ArrayList<Integer>();
arr.add(a);
arr.add(b);
System.out.println("arr (1st) = " + arr.get(0) + " and " + "arr (2nd) = " + arr.get(1));

swap(arr.get(0), arr.get(1));
// values stay the same
System.out.println("arr (1st) = " + arr.get(0) + " and " + " arr (2nd) = " + arr.get(1));

Integer c = a + b;
System.out.println("c = " + c);
arr (1st) = 95 and arr (2nd) = 31
arr (1st) = 95 and  arr (2nd) = 31
c = 126

double/Double

void swap (double a, double b) {
  double temp = a;
  a = b;
  b = temp;
}

double a = Math.random();
double b = Math.random();
System.out.println("a = " + a + " and " + "b = " + b);

swap(a, b);
// values stay the same
System.out.println("a = " + a + " and " + "b = " + b);

double c = a + b;
System.out.println("c = " + c);
a = 0.5392976519054533 and b = 0.7136309112889999
a = 0.5392976519054533 and b = 0.7136309112889999
c = 1.2529285631944531
void swap (Double a, Double b) {
  Double temp = a;
  a = b;
  b = temp;
}

Double a = new Double(Math.random());
Double b = new Double(Math.random());
ArrayList<Double> arr = new ArrayList<>();
arr.add(a);
arr.add(b);

System.out.println("arr (1st) = " + arr.get(0) + " and " + "arr (2nd) = " + arr.get(1));

swap(arr.get(0), arr.get(1));
// values stay the same
System.out.println("arr (1st) = " + arr.get(0) + " and " + "arr (2nd) = " + arr.get(1));

double c = a + b;
System.out.println("c = " + c);
arr (1st) = 0.8714734691329225 and arr (2nd) = 0.958581170162068
arr (1st) = 0.8714734691329225 and arr (2nd) = 0.958581170162068
c = 1.8300546392949903

boolean/Boolean

void swap (boolean a, boolean b) {
  boolean temp = a;
  a = b;
  b = temp;
}

boolean a = true;
boolean b = false;
System.out.println("a = " + a + " and " + "b = " + b);

swap(a, b);
// values stay the same
System.out.println("a = " + a + " and " + "b = " + b);

boolean c = a || b;
System.out.println("c = " + c);
a = true and b = false
a = true and b = false
c = true
void swap (Boolean a, Boolean b) {
  Boolean temp = a;
  a = b;
  b = temp;
}

Boolean a = true;
Boolean b = false;
ArrayList<Boolean> arr = new ArrayList<>();
arr.add(a);
arr.add(b);

System.out.println("arr (1st) = " + arr.get(0) + " and " + "arr (2nd) = " + arr.get(1));

swap(arr.get(0), arr.get(1));
// values stay the same
System.out.println("arr (1st) = " + arr.get(0) + " and " + "arr (2nd) = " + arr.get(1));

boolean c = a || b;
System.out.println("c = " + c);
arr (1st) = true and arr (2nd) = false
arr (1st) = true and arr (2nd) = false
c = true

char/Character

void swapCh (char a, char b) {
  char temp = a;
  a = b;
  b = temp;
}

char a = 'a';
char b = 'b';
System.out.println("a = " + a + " and " + "b = " + b);

swapCh(a, b);
// values stay the same
System.out.println("a = " + a + " and " + "b = " + b);

char[] c = {a, b};
String str = new String(c);
System.out.println("str = " + str);

System.out.println("str substring 0 to 1 = " + str.substring(0,1));
a = a and b = b
a = a and b = b
str = ab
str substring 0 to 1 = a
void swapCh (Character a, Character b) {
  Character temp = a;
  a = b;
  b = temp;
}

Character a = new Character('a');
Character b = new Character('b');
ArrayList<Character> arr = new ArrayList<>();
arr.add(a);
arr.add(b);

System.out.println("arr (1st) = " + arr.get(0) + " and " + "arr (2nd) = " + arr.get(1));

swapCh(arr.get(0), arr.get(1));
// values stay the same
System.out.println("arr (1st) = " + arr.get(0) + " and " + "arr (2nd) = " + arr.get(1));

char[] c = new char[arr.size()];
for (int i = 0; i<arr.size(); i++) {
  c[i] = arr.get(i);
}

String str = new String(c);
System.out.println("str = " + str);

System.out.println("str substring 0 to 1 = " + str.substring(0,1));
arr (1st) = a and arr (2nd) = b
arr (1st) = a and arr (2nd) = b
str = ab
str substring 0 to 1 = a