Created
February 23, 2018 16:10
-
-
Save Sharabaddin/50175df0d878893010a4381fc2c837c6 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 HelloWorld{ | |
public static void main(String []args){ | |
// Call task 1 | |
checkBinaryOne(5); | |
// Call task 2 | |
reverseArray(int[] {1,2,3}) | |
} | |
//task1 | |
public static double checkBinaryOne(int testDigit) { | |
double sum = 0; | |
for(int i = 0; i < MAX_VALUE * 4; i++) { | |
if (testDigit & i) { | |
sum++; | |
} | |
} | |
return sum; | |
} | |
//task1 | |
public static int[] reverseArray(int[] array) { | |
int[] resultArray = new int[array.length]; | |
for(int = 0; i < array.length; i++) { | |
resultArray[i] = array[array.length -1] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment