Created
July 25, 2014 22:55
-
-
Save jyhjuzi/4e3df8009a547d751d90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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