I have these two lines of code that I need to modify so that they will always return four digits of binary.
String binary1 = Integer.toBinaryString(t1);
String binary2 = Integer.toBinaryString(t2);
String first1 = binary1.substring(0,0);
String first2 = binary2.substring(0,0);
String second1 = binary1.substring(1,1);
String second2 = binary2.substring(1,1);
String third1 = binary1.substring(2,2);
String third2 = binary2.substring(3,3);
String fourth1 = binary1.substring(4,4);
String fourth2 = binary2.substring(4,4);
Is there a method that cn controll the amount of digits in binary1 and binary2
P.S. T1 and T2 are two user-subitted imputs.