Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: Labelling Number Array

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Thanked 0 Times in 0 Posts

    Default Labelling Array

    I made this code to calculate numbers:

    import java.util.Random;
    public class Sorting {
    private double[] player;
    private int k=5;
    private int j=5;
    public void sort(){
        player = new double[k];
        for(int i=1;i<k;i++){
            double tempp ;
                    tempp = Math.random() * i;
                    System.out.println("Result "+i+"="+player[i]);
    public static void main(String []args){
        Sorting k=new Sorting();

    and the result is:

    Result 1=0.4529689730194949
    Result 2=0.09643822768644617
    Result 3=1.841047494651026
    Result 4=2.1807153629323777

    Now, I want to add a label from the biggest to the smallest result number labeled EXCELLENT, VERY GOOD, GOOD and BAD like this:

    Result 1=0.4529689730194949 labeled GOOD
    Result 2=0.09643822768644617 labeled BAD
    Result 3=1.841047494651026 labeled VERY GOOD
    Result 4=2.1807153629323777 labeled EXCELLENT
    Last edited by andewor; October 14th, 2012 at 04:12 AM.

Similar Threads

  1. [SOLVED] how to find all occurrences of a number in an array recursivelly
    By mia_tech in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 13th, 2012, 01:37 PM
  2. Find Biggest Number in Array
    By jo15765 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 12th, 2012, 03:01 PM
  3. Search for number in array and return index
    By Kevinius in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 24th, 2011, 12:00 AM
  4. Number Array
    By TheJavaGuy in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 17th, 2011, 04:59 AM
  5. Finding the highest number in an array?
    By halfwaygone in forum Algorithms & Recursion
    Replies: 1
    Last Post: April 17th, 2010, 03:56 PM

Tags for this Thread