# Sorting an Array (Ascending Order)

Page 1 of 1

## 1 Replies - 3376 Views - Last Post: 21 May 2009 - 09:44 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=106332&amp;s=77dc016b4ef48f80fae9d368e33c7623&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 zanyrogue

Reputation: 0
• Posts: 91
• Joined: 16-January 09

# Sorting an Array (Ascending Order)

Posted 21 May 2009 - 08:33 AM

Hi, I need help in being able to sort this array. I'd like to sort it in ascending order.

```class Ascending2
{
public static void main (String [] args)
{

int n[];
n = new int[5];

n[0]=9;
n[1]=5;
n[2]=11;
n[3]=5;
n[4]=8;

for (int i=0; i<5; i++)
System.out.println(n[i]);

}
}

```

Is This A Good Question/Topic? 0

## Replies To: Sorting an Array (Ascending Order)

### #2 ralph_komer

Reputation: 13
• Posts: 71
• Joined: 12-May 09

## Re: Sorting an Array (Ascending Order)

Posted 21 May 2009 - 09:44 AM

You need to apply a sorting algorithm to this array like selection, insertion, bubble or quick sort. If you have any issues in implementation then only we can help you.