Hey guys!

i need help on reversing numbers in descending order.

public class ArrayExercise1 {
    public static void main(String[] args) {
        int[] values = new int[10];

        values[ 0 ] = 1;
        values[ 1 ] = 4;
        values[ 2 ] = 9;
        values[ 3 ] = 16;
        values[ 4 ] = 17; 
        values[ 5 ] = 21;
        values[ 6 ] = 25;
        values[ 7 ] = 33;
        values[ 8 ] = 37;
        values[ 9 ] = 40;


        for(int count = 0; count < values.length; count++) {

        System.out.println(values[ count ]);


        }
    }
}

Once run, the numbers appear in the right order. But I am stuck on how to reverse them. Some say its easy but i can't figure it out!

Get back to me, thanks

for(int count = values.length-1; count >= 0; count--){
    		System.out.println(values[count]);
    	}

thanks! got that bit wrong!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.