Results 1 to 3 of 3
  1. #1
    tyang is offline Member
    Join Date
    Jan 2010
    Posts
    44
    Rep Power
    0

    Default How to order a vector?

    Does any experts know how to order a vector?
    e.g. Double a[] = {1, -1, 4, 10};
    How can I make it like {-1,1,4,10}?

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by tyang View Post
    Does any experts know how to order a vector?
    e.g. Double a[] = {1, -1, 4, 10};
    How can I make it like {-1,1,4,10}?
    That is not a Vector (technically speaking) that is an array. Have a look at one of the Arrays.sort( ... ) methods instead.

    kind regards,

    Jos

Similar Threads

  1. Java Run Order
    By collin389 in forum New To Java
    Replies: 15
    Last Post: 11-24-2009, 08:22 AM
  2. Vector<vector> loop thru
    By ocean in forum New To Java
    Replies: 11
    Last Post: 11-21-2009, 03:17 PM
  3. Instantiation order
    By Jeremy720 in forum New To Java
    Replies: 3
    Last Post: 07-17-2009, 04:19 PM
  4. Changing panel Z order
    By Joe2003 in forum AWT / Swing
    Replies: 2
    Last Post: 02-20-2009, 04:51 PM
  5. Descending order
    By santanu in forum New To Java
    Replies: 1
    Last Post: 11-04-2008, 05:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •