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

  • Home
  • SEARCH
  • 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 7852791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:30:24+00:00 2026-06-02T19:30:24+00:00

I keep getting an error that states my String index is out of range

  • 0

I keep getting an error that states my String index is out of range at String.charAt, PasswordGenerator.matchCharAt, and Driver.main. I don’t know what that means exactly. Also my characters won’t append to one line from the stringbuilder class that I already instantiated. I was wondering if maybe that was caused by the String index error or whether it was my fault.

public class Driver {

    public static void main(String[] args) {
        int length=0;
        int MaxNumber=100;
        StringBuilder password = new StringBuilder();

        do {
            if (PasswordGenerator.matchLength (length))
                System.out.println("The length of the character is " + length);
            length++;                                     // length is randomly picked
        } while (length < MaxNumber );   // or <100

        int index = 0;
        char f = 0;

        for (int d = 0; d < 127 || ; d++) {
            if  (PasswordGenerator.matchCharAt(f, index))
                d = (char) index;
            char aChar = (char)d;
            password.append(aChar);
            System.out.println("Password is: " + aChar);
            index++;

        }
    }
}
  • 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-06-02T19:30:27+00:00Added an answer on June 2, 2026 at 7:30 pm

    You are getting the error since idx will vary between 0 and 127. The password from the PasswordGenerator is probably not that long. For example, before you ask whether there is a match at index 57, you must ask if 57 is less than the length of the password.

    So your task is to guess the password that the generator saves? Then you should do this:

    Get to know the length of the password.
    For each index from 0 upto but excluding the length:
        Guess the character at that index.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting the error in VS 2100 CRT detected that the application wrote
I've created a singleton class that loads a plist. I keep getting this error
Using this SP I keep getting an error on the UPDATE statement indicating that
I keep getting this error because the VendorID is null for that record. I've
I keep getting errors that my functions have been defined multiple times. Of course
I use __autoload to load classes, and I keep getting errors that no class
With the following code, I keep getting error C2535 when I compile. It's complaining
I'm trying to code some stuff for a game but I keep getting error
Keep getting this error after inserting a subdatasheet into a query and trying to
Keep getting the error Arguments are not sufficiently instantiated for the multiplication by addition

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.