File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Printing a sorted array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Printing a sorted array" Watch "Printing a sorted array" New topic
Author

Printing a sorted array

James Palmer
Ranch Hand

Joined: Mar 15, 2004
Posts: 36
Hello, i have an array with 3 items in it and i want to print them in ascending order in a toString method.My code is:
public String toString() {
Arrays.sort(pile);
return "{" + (pile) + "}";
}
What do i need to change to this to get it working.Thanks
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Try this
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing a sorted array
 
Similar Threads
a better way to convert List to array?
Differnce between new String(Byte[]) and byte[].toString()
trouble with an array
Array of Objects to be passed into a method
Sorting arrays