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: Finding the highest number in an array?

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Finding the highest number in an array?

    I'm trying to find the highest two numbers in an array, and once these are found correspond them to another array.

    Anyone have any idea how to do so?

    Thanks.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Finding the highest number in an array?

    Probably the simplest way is to sort your array of numbers and then pick out the first two.

    Two simple algorithms:

    Insertion sort
    Selection sort

Similar Threads

  1. How to find location of ipaddress using Java
    By tej in forum Java Networking
    Replies: 8
    Last Post: September 8th, 2012, 06:05 AM
  2. Averages, Highest & using a .csv file ! ? ! ?
    By thebigtimeGNAR in forum Java Theory & Questions
    Replies: 3
    Last Post: April 14th, 2010, 11:35 AM
  3. Inputing file (.txt) and finding the highest number in the file
    By alf in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 15th, 2010, 09:11 AM
  4. Need Help - Factoring & Prime Finding Code
    By prodigytoast in forum Algorithms & Recursion
    Replies: 5
    Last Post: November 5th, 2009, 07:38 AM
  5. Replies: 13
    Last Post: May 6th, 2009, 09:27 AM