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 3 of 3

Thread: Programming help with java assignment!

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Thanked 0 Times in 0 Posts

    Default Programming help with java assignment!

    How do I get my program to recognize numbers in a row and print the number that appears the most times consecutively in that row.I also need to print the most amount of times it appears consecutively in the row.

    eg 1223336677777889771666

    most times= 5

    help plz Tnx
    Last edited by kami21; June 15th, 2011 at 03:31 PM.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,273 Times in 2,244 Posts

    Default Re: Programming help with java assignment!

    What data type is the number stored in? String or int or long or ?
    If not String, convert it to a String and then use one of the String class's methods to look at the digits one at a time in a loop and count them.

  3. #3
    Grand Poobah
    Join Date
    Mar 2011
    My Mood
    Thanked 167 Times in 158 Posts

    Default Re: Programming help with java assignment!


    What should your output be for the above? The number 1 appears the most times but number 2 appears consecutively the most but according to your requirements the output should be

    most times=1

Similar Threads

  1. Programming assignment using inheritance
    By Slypher in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 4th, 2011, 05:42 PM
  2. [SOLVED] OOP java assignment
    By enkei in forum Object Oriented Programming
    Replies: 1
    Last Post: April 27th, 2011, 11:16 AM
  3. programming assignment help
    By sdgseed in forum Threads
    Replies: 1
    Last Post: October 20th, 2010, 02:43 PM
  4. my java assignment -- please help
    By java_beginner in forum Java Theory & Questions
    Replies: 6
    Last Post: May 20th, 2010, 08:32 AM
  5. Replies: 1
    Last Post: February 22nd, 2010, 07:20 AM