java newbie... sort array
How do I sort an array of "-" delimited numbers?
The array will contain numbers like this:
Any clue on how I can sort that?
nevermind... I'm real new w/ java...
one option is to read the numbers like string and remove "-" from it and convert it back to numbers and sort (like ordinary numbers).
The other option if format is fixed for all numbers is to look at the first part of the number and compare i.e if the numbers are
Then comapring the first digit (0 & 1) yields the order regardless of the remaining digits. If the first digit is same then go to the second one and so on till order is sorted out but beware if the format is not fixed then it will not work e.g
in this case since the format is different the second number though bigger may end up as a smaller number in comparison.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL