SHARE
TWEET

max of vectors (3)

DulcetAirman Aug 16th, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ch.claude_martin;
  2.  
  3. import java.util.Arrays;
  4. import java.util.OptionalInt;
  5.  
  6. public class SomeClass {
  7.  
  8.   public static void main(String[] args) {
  9.     final int[] v1 = { 3, 5 };
  10.     final int[] v2 = { 3, 6 };
  11.     final int[] v3 = {};
  12.     final int[] v4 = { -1, Integer.MIN_VALUE };
  13.     long max = Long.MIN_VALUE;
  14.     int[] maxVec = null;
  15.     for (???????????) {
  16.       final OptionalInt m = Arrays.stream(v).max();
  17.       if (???????????) {
  18.         max = m.getAsInt();
  19.         maxVec = v;
  20.       }
  21.     }
  22.  
  23.     if (?????)
  24.       System.out.println(max + " -> " + Arrays.toString(maxVec));
  25.     else
  26.       System.out.println("No data");
  27.   }
  28. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top