Skip to content

Instantly share code, notes, and snippets.

@jyhjuzi
Created July 25, 2014 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyhjuzi/4e3df8009a547d751d90 to your computer and use it in GitHub Desktop.
Save jyhjuzi/4e3df8009a547d751d90 to your computer and use it in GitHub Desktop.
public class Q5_5{
public static void main(String[] args){
int test1= 0b100111010110;
int test2= 0b011001000101;
System.out.println(numberOfCovert(test1,test2));
}
static int numOfConvert(int number1, int number2){
int temp = number1^ number2;
int count = 0;
while(temp>0){
if(temp%2 == 1)
count++;
temp = temp/2;
}
return count;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment