daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. public class Test {
  3. public static void main(String[] args) {
  4.     int[] array= {1,2,4,6};
  5.  
  6.     System.out.println(array(array));
  7. }
  8. public static int array(int[] array) {
  9.     double sum=0;
  10.     for(int x:array) {
  11.         if(x%2==0) {
  12.             sum++;
  13.         }
  14.     }
  15.     return (int) Math.pow((int)2, sum)-1;
  16. }
  17.  
  18.  
  19. }
RAW Paste Data
Top