SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Random;
  5.  
  6. public class Main {
  7.  
  8.     public static void main(String[] args) {
  9.         ArrayList<Piki> pikis = new ArrayList<>();
  10.         Random rnd = new Random(System.currentTimeMillis());
  11.         for ( int i= 0; i < 100; i++){
  12.         Piki piki = new Piki("Piki " + i, 1 + rnd.nextInt(100), 100 + rnd.nextInt(1000) );
  13.         pikis.add(i, piki);
  14.         }
  15.         for  (int i=0;  i < 100; i ++){
  16.             int y = pikis.get(i).getLength();
  17.             for (int j =0; j <= i; j ++){
  18.              if (y < pikis.get(j).getLength())
  19.                 { pikis.get(y).setLength(y);}
  20.              break;
  21.             }
  22.             i ++;
  23.         }
  24.         for (int i = 0; i < 100; i ++){
  25.             System.out.println(pikis.get(i).getLength());
  26.         }
  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
 
Top