Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Filling arrays in Java

Name: Anonymous 2011-11-19 13:45

Sup /prog/?

I am working on a small password generator in Java, and I need some help filling a char array.

Basically, I need to fill it automatically with numbers that will relate to the ASCII values of 33 - 126.

I want to do this with a for loop, and so far all I have is this

for(int i = 0; i < charArray.length; i++)
        {
            charArray[i] = (char)(i + 1);
            System.out.println(charArray[i]);
        }

As you can see, that starts filling it so that element 0 has a value of 1, element 1 has a value of 2, etc. I need it to start at 33 and then increment by one, so element 0 has a value of 33, element 1 has a value of 34, etc.

Can anyone tell me how I would do this? I know this is a total noob question, I'm just stuck.

Name: Anonymous 2011-11-19 16:42

>>11
You shouldn't have problems with what you're trying to do after an hour. If you've been at it for a week and still couldn't figure it out then you're really dumb.

>>13
Do you really think that if he can't add 33 to a number in Java he'll be capable of even finishing the first subchapter of SICP?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List