Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement