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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 2 of 2

Thread: Sorting multiple digit numbers

  1. #1
    Member
    Join Date
    May 2013
    Posts
    165
    Thanks
    58
    Thanked 1 Time in 1 Post

    Default Sorting multiple digit numbers

    Is there any way I can sort multiple digit numbers in a more natural form instead of:

    e.g. [1,123,2222222222222,9]


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Sorting multiple digit numbers

    Use their numeric values. What you've posted looks like they were sorted as Strings.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    keepStriving (November 16th, 2013)

Similar Threads

  1. ISBN-10 enter 9 digit to find the 10th digit
    By cldance5678 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 28th, 2013, 02:52 PM
  2. I need help to write encrypt and decrypt 4 digit numbers.
    By shin777 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 29th, 2013, 01:07 PM
  3. Creating a 8 digit password mixture of numbers and letters
    By djl1990 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 28th, 2012, 03:53 PM
  4. Adding 100 single digit numbers to a Text Field
    By CodyReuille in forum Java Theory & Questions
    Replies: 2
    Last Post: July 3rd, 2012, 03:58 PM
  5. How to generate 13 digit numbers to text file
    By duanedtp in forum Java Theory & Questions
    Replies: 3
    Last Post: April 27th, 2011, 11:30 AM