SHARE
TWEET

Untitled

a guest Aug 20th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.gmail.volodimir.bazhan;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         int[] array = { -5, -2, -9 };
  7.         int a = getMax(array);
  8.         System.out.println(a);
  9.  
  10.     }
  11.  
  12.     static int getMax(int[] array) {
  13.         int max=array[0];
  14.         for (int i = 0; i < array.length; i++) {
  15.  
  16.             if (max < array[i]) {
  17.                 max = array[i];
  18.             }
  19.         }
  20.         return max;
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top