Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 519407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:02:17+00:00 2026-05-13T08:02:17+00:00

/* Method: findName() */ /** * Finds the name of the entry and sets

  • 0
/* Method: findName() */
/**
 * Finds the name of the entry and sets it to the name variable.
 */
    private void findName(String line){
        end = line.indexOf(" ");
        name = line.substring(0,end);
    }

/* Method: findDecades() */
/**
 * Finds the name of the entry and sets it to the name variable.
 */
    private void findDecades(String line){
        for(int i = 0; i<NDECADES; i++){
            int start = end + 1;
            end = line.indexOf(" ",start);
            String decadeTemp = line.substring(start, end);
            data[i] = Integer.parseInt(decadeTemp);
        }
    }

Line looks like the following:

Sam 58 69 99 131 168 236 278 380 467 408 466

When I run the code the first method runs fine but then it throws an error exception when it reaches the line:

            String decadeTemp = line.substring(start, end);

edit:

the error that is throw is:

throw new StringIndexOutOfBoundsException(endIndex – beginIndex);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:02:17+00:00Added an answer on May 13, 2026 at 8:02 am

    Problem solved NDECADES was one space too big.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The method is defined as below: public static void checkNotNull<T extends Throwable>(Object value, String
This is the code i have written to dynamically generate Controls: private void GenCtrl(string
Quick method description: I have two tables, lets name them table ONE and table
Method 'Private Sub trigger_Triggered(sender As Object, e As OamsIDD.VoamsWorldIDD.OamsStateChangeEventArgs)' cannot handle event 'Public Event
Method A in Class A (Non GUI) public void add() { if(etc...) { add
This method finds the largest node in a BST returns its value and deletes
Method overloading allows us to define many methods with the same name but with
//method public static String foo(String s) { if (s.length() == 1) return s; else
Method causing error inside my ContentProvider public static Cursor getSuggestions(String query) { SQLiteDatabase db
Method chaining is the practice of object methods returning the object itself in order

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.