Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- public static void main(String[] args) {
- int[] array= {1,2,4,6};
- System.out.println(array(array));
- }
- public static int array(int[] array) {
- double sum=0;
- for(int x:array) {
- if(x%2==0) {
- sum++;
- }
- }
- return (int) Math.pow((int)2, sum)-1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement