Results 1 to 2 of 2
  1. #1
    patz is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default For loops and while loops

    I am an ok java programmer but struggle when it comes to loops.

    Im trying to implement a brute force attack at the moment, it can perfrom an attack using a nested For loop. But I am trying to change it to a while loop.
    While loops are what I have major issues with.

    this is the For loop i have:

    for (int e = 0; e < 37; e++) {
    bAtt[5] = alphanum[e];
    for (int f = 0; f < 37; f++) {
    bAtt[4] = alphanum[f];

    for (int h = 0; h < 37; h++) {
    bAtt[3] = alphanum[h];
    for (int g = 0; g < 37; g++) {
    bAtt[2] = alphanum[g];

    for (int i = 0; i < 37; i++) {
    bAtt[1] = alphanum[i];
    for (int j = 0; j < 37; j++) {
    bAtt[0] = alphanum[j];

    if i could get some help as to how someone would approach to do this in a while loop that would be great.

    thanks patz.

  2. #2
    patz is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default

    Quote Originally Posted by patz View Post
    I am an ok java programmer but struggle when it comes to loops.

    Im trying to implement a brute force attack at the moment, it can perfrom an attack using a nested For loop. But I am trying to change it to a while loop.
    While loops are what I have major issues with.

    this is the For loop i have:

    for (int e = 0; e < 37; e++) {
    bAtt[5] = alphanum[e];
    for (int f = 0; f < 37; f++) {
    bAtt[4] = alphanum[f];

    for (int h = 0; h < 37; h++) {
    bAtt[3] = alphanum[h];
    for (int g = 0; g < 37; g++) {
    bAtt[2] = alphanum[g];

    for (int i = 0; i < 37; i++) {
    bAtt[1] = alphanum[i];
    for (int j = 0; j < 37; j++) {
    bAtt[0] = alphanum[j];

    if i could get some help as to how someone would approach to do this in a while loop that would be great.

    thanks patz.
    apologies that was unclear

    String[] bAtt = new bAtt[6];
    String[] alphanum = {"", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
    "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w",
    "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};

    for (int e = 0; e < 37; e++) {
    bAtt[5] = alphanum[e];
    for (int f = 0; f < 37; f++) {
    bAtt[4] = alphanum[f];

    for (int h = 0; h < 37; h++) {
    bAtt[3] = alphanum[h];
    for (int g = 0; g < 37; g++) {
    bAtt[2] = alphanum[g];

    for (int i = 0; i < 37; i++) {
    bAtt[1] = alphanum[i];
    for (int j = 0; j < 37; j++) {
    bAtt[0] = alphanum[j];

Similar Threads

  1. Help with Loops
    By Spyderpig in forum New To Java
    Replies: 10
    Last Post: 02-17-2011, 08:10 AM
  2. loops
    By curioustoknow in forum New To Java
    Replies: 3
    Last Post: 02-06-2011, 01:45 PM
  3. Help with loops
    By pg5678pg in forum New To Java
    Replies: 8
    Last Post: 10-17-2010, 06:51 PM
  4. these loops...
    By Blaedel in forum New To Java
    Replies: 0
    Last Post: 10-01-2009, 06:59 PM
  5. how to use do while loops
    By mikeitalydz in forum New To Java
    Replies: 32
    Last Post: 09-26-2009, 08:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •