i want following suppose there is given two number 5 and 3
for example
5//101 and 3 //011 to concat these bits 101110 and we get 46 here is code for this task
public class concat {
public static void main(String[] args) {
int t=0;
int k=5;
int x=3;
int i=0;
while ( i<3 ){
t=x%2;
x/=2;
k<<=1;
k |=t;
++i;
}
System.out.println(k);
}
}
i have question how can done vice verse or not 101110 but 101011? thanks