Advertisement
Guest User

Untitled

a guest
Sep 25th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public class HelloWorld{
  2.  
  3. public static void main(String []args){
  4.  
  5. int[] myIntArray = {2,1,1,7,7,2,2,3};
  6. System.out.println(takeArray(myIntArray));
  7. }
  8.  
  9. public static boolean takeArray(int [] input){
  10.  
  11. for (int i = 0; i <= input.length-3; i++){
  12. if ((input[i]+input[i+1]+input[i+2])==7){
  13. return true;
  14. }
  15.  
  16. }
  17. return false;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement