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 18:30

>>17
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?
Isn't that how most of the smug lisp weenies are formed? Because I'm pretty sure that that's exactly how most of the smug lisp weenies are formed!

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