Skip to content

Instantly share code, notes, and snippets.

@Sharabaddin
Created February 23, 2018 16:10
Show Gist options
  • Save Sharabaddin/50175df0d878893010a4381fc2c837c6 to your computer and use it in GitHub Desktop.
Save Sharabaddin/50175df0d878893010a4381fc2c837c6 to your computer and use it in GitHub Desktop.
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