Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1.  
  2.         int maxValue = array[0];
  3.         int minValue = array[0];
  4.         int i = 0;
  5.  
  6.         while (i != arrayLength) {
  7.             if (array[i] > array[i + 1]) {
  8.                 if (array[i] > maxValue) {
  9.                     maxValue = array[i];
  10.                 }
  11.             if (array[i + 1] < minValue) {
  12.                 minValue = array[i + 1];
  13.             }
  14.             } else {
  15.                 if (array[i + 1] > maxValue) {
  16.                     maxValue = array[i + 1];
  17.                 }
  18.                 if (array[i] < minValue) {
  19.                     minValue = array[i];
  20.                 }
  21.             }
  22.             i += 2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement