Top 5 Highest Kills || ASAP PLZ!

Discussion in 'Plugin Development' started by WingedMLGPro, Mar 30, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    WingedMLGPro

    Hey Everyone,
    I am trying to make a Top 5 kills command where it gets the top 5 highest ints in the
    config file i have created. But i dont know how to do this!
    Plz help me.

    here is my Events Class for the stats:

    http://pastebin.com/b1C24c58

    here is my Command Class:

    http://pastebin.com/U92DdmvE

    Thanks Everyone!

    WingedMLGPro!
     
  2. Offline

    WladHD

    You add all the Integers to an list and get the top 5 values.
    Code (open)
    Code:
    int x = 5;
    //Put all integers into a list
    List<Integer> list;
    //Sort the list
    Collections.sort(list);
    //Get the 5 Top values from the list.
    List<Integer> top5 =new ArrayList<Integer>(list.subList(list.size()-x, list.size()));
    
     
    Fruitninja567 likes this.
Thread Status:
Not open for further replies.

Share This Page