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.


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

Results 1 to 2 of 2

Thread: finding specified NUMBERS in an array

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Thanked 0 Times in 0 Posts

    Default finding specified NUMBERS in an array

    for (i = 0 ; i < list.length ; i++){
    if (list[i] == list2[0])
    location = i;

    ok i have that code which locates a single number but i cant figure out how to continue in the sequence,
    i have an array of 50 which is loaded with random numbers between 1-9..
    then i input 4 numbers which i place in an array of 4...

    then once the random numbers get displayed the user chooses a sequence of numbers say

    then the user inputs 9,2,1,4 as the sequence so my question;
    how can i get get past the other 9 in the array, all i have is

    for (i = 0 ; i < list.length ; i++){
    if (list[i] == list2[0])
    location = i;
    if (list[location + 1] == list2[1])


    while (choice == false);


  2. #2
    Join Date
    May 2010
    North Central Illinois
    My Mood
    Thanked 112 Times in 110 Posts

    Default Re: finding specified NUMBERS in an array

    A sequence as in a bunch of single ints, or more like a String?

    That number is a String if just one number.

    put code in [highlight=java] Code [/highlight] .

Similar Threads

  1. random numbers in array please help
    By gonfreecks in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 15th, 2010, 01:54 AM
  2. finding pi
    By gonfreecks in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: November 2nd, 2010, 05:15 PM
  3. Averaging Numbers in an Array Based on References
    By aussiemcgr in forum Java Theory & Questions
    Replies: 6
    Last Post: August 6th, 2010, 06:39 PM
  4. How to write 2 dimensional array of float numbers to binary file?
    By Ghuynh in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: June 17th, 2010, 04:26 PM
  5. Finding the highest number in an array?
    By halfwaygone in forum Algorithms & Recursion
    Replies: 1
    Last Post: April 17th, 2010, 03:56 PM