willieshi232

Untitled

Dec 3rd, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. 1.
  2. e
  3. 2.
  4. First element: numbers[0]
  5. Last element: numbers[9] or numbers[numbers.length - 1]
  6. 3.
  7. int[] data = new int[5];
  8. data[0] = 27;
  9. data[1] = 51
  10. data[2] = 33
  11. data[3] = -1
  12. data[4] = 101
  13. 4.
  14. int[] odds = new int[22];
  15. for (int i = 0; i < 22; i++)
  16. {
  17. odds[i] = i * 2 - 5;
  18. }
  19. 5.
  20. [0, 4, 11, 0, 44, 0, 0, 2]
  21. 6.
  22. [3, 3, 0, 0, 6, 9, -0, -18 ]
  23. 7.
  24. You can't print arrrays using println and you can't compare arrays using the ==
  25. 8.
  26. a
  27. 9.
  28. int[] data = {7, -1, 13, 24, 6};
  29. 10.
  30. int[] Shaymin = new int[5]
  31. for(int i = 0; i < 5; i++)
  32. {
  33. int start = Shaymin[0]
  34. int max = 0
  35. if(start > max)
  36. {
  37. max = start;
  38. }
  39. }
  40. 11.
  41. public static double average(int[] a) {
  42. double mean = 0.0;
  43. for (int i = 0; i < a.length; i++) {
  44. mean += a[i];
  45. }
  46. return mean / a.length;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment