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 7864609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:50:10+00:00 2026-06-02T23:50:10+00:00

public class Driver { public static void main(String[] args) { int length=0; int MaxNumber=100;

  • 0
public class Driver {

public static void main(String[] args) {


    int length=0;
    int MaxNumber=100;
    StringBuilder password = new StringBuilder();





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


    int index = 0;
    char f = 0;


    for (char d = 0; d < 127; d++) {
        if(PasswordGenerator.matchCharAt(d, index)) {
            password.append(d);
            System.out.println("Hey! Char at " + index + " is " + d);
            d++;
        }
    }



}
}

So I have found how to find the first character of my randomly generated password via loop, and was wondering how I could provide it to find the other characters in the password by using either that loop or another. The characters follow how long the loop is which is also randomly generated. The documentation to the PasswordGenerator class is here.. (http://www.technology.heartland.edu/faculty/todds/csci130/assignments/A5_password/doc/index.html)

  • 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-02T23:50:11+00:00Added an answer on June 2, 2026 at 11:50 pm

    Change the value of index to the position of the character you are trying to find. If you want to find all of them then…

    for(int j=0; j < length; j++)
    {
          for (char d = 0; d < 127; d++) 
          {
            if(PasswordGenerator.matchCharAt(d, j)) 
            {
                password.append(d);
                System.out.println("Hey! Char at " + index + " is " + d);
    
                // No sense in incrementing d and going through all of them
                // You found it already, break this loop
                break;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class Driver { public static void main(String[] args) { int length=0; int MaxNumber=100;
Hi I have following code block public class Driver { static String x =
public class TestBL { public static void AddFolder(string folderName) { using (var ts =
public class Order { static Customer cust = new Customer(); string sEmpty = ;
My code is- package textmessenger; import java.sql.*; public class Main { public static void
public class Ex7 { private int fld; private void meth(int val) { fld =
public class UploadHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { ... // Create
As title says, mock code to demostrate my problem Driver Class import java.io.*; public
So I have the following classes: class A{ public A(int n1){ n=n1; } int
using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; namespace Orchard.Webshop.Drivers { public class ProductDriver : ContentPartDriver<ProductPart> { protected

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.