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

Pages: 1-

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 13:52

int i = 0
(i + 1)
The solution is obvious and involves modification of one and only one of those two expressions. If you can't figure what to do you're really bad.

Name: Anonymous 2011-11-19 13:56

Yeah I got it, just had a brain fart.

Name: Anonymous 2011-11-19 14:09

God damn where do these retards come from?

Name: Anonymous 2011-11-19 14:22

>>4
From anime boards, obviously.

Name: Anonymous 2011-11-19 14:25

>>4
>>5

I mostly lurk on /g/, but this is my first foray in to programming D:

Name: Anonymous 2011-11-19 14:53

>>4

from the land of people who are no yet enterpriseprogrammers. weallhavetostartsomewhere

Name: Anonymous 2011-11-19 15:22

>>6
You're a fucking retard, I never had issues like this, you will never be a successful programmer because of your inferior genetic material, please do not have children and please stop posting.

Thank you.

Name: Anonymous 2011-11-19 15:31

>>8

Damn bro, you mad as fuck

Name: Anonymous 2011-11-19 15:51

>>9
I'm not mad at all, I just explained to you why you will never be a successful programmer.
You're not supposed to have issues with stuff like >>1, nobody but retards have them.

Name: Anonymous 2011-11-19 15:53

>>10

You need to chill, I've been at this for less than a week, and I am doing it in my spare time.

Name: Anonymous 2011-11-19 16:06

>>11
I am perfectly calm, there is no need for me to ``chill''.
I'm just explaining to you why programming is not a worthwhile pursuit for you, you will not be successful and should try something else, something more suited to a person at your level of ability/intelligence.

Name: Anonymous 2011-11-19 16:08

>>12
Another possibility is that he's following some shitty programming tutorial.

>>1, please read SICPhttp://mitpress.mit.edu/sicp/full-text/book/book.html.

Name: Anonymous 2011-11-19 16:34

>>12
>Sees somebody can't ride a bike on their first try
>Riding bikes is not a worthwhile pursuit for you

Name: Anonymous 2011-11-19 16:38

>>14
Most people fall off the bike because it takes a while to learn to properly balance it. Some people fall of the bike because they have no arms or legs. You can usually spot the difference.

Name: Anonymous 2011-11-19 16:40

>>15
Trick question. This kid is getting trolled off the bike.

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?

Name: Anonymous 2011-11-19 17:40

>>17
This motherfucker is a proper troll.

Kid, keep at it. You will get there eventually.

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!

Name: Anonymous 2011-11-19 18:55

>>19
Until you write fibs and fact in shitty languages like C++, you cannot appreciate the beauty of a lisp.

Name: Anonymous 2011-11-19 18:57

>>13
Take SICP and shove it up your ass you fucking hourly nigger. Seriously, SICP hasn't gotten you a programming job at google or microsoft. Now go fuck you.

Name: Anonymous 2011-11-19 19:20

lisp is shit

Name: Anonymous 2011-11-19 19:30

>>22
Suck my cock dude.

Name: Anonymous 2011-11-19 20:05

>>23
I bet the authors of SICP would wanna kick the shit out of if they found out you read this book only to end up working some shit hourly job at some hick firm.

Name: Anonymous 2011-11-19 20:18

>>24
Better having no job at all, than having Java job. Java is like cleaning toilets at McDonalds your whole life.

Name: Anonymous 2011-11-19 20:23

>>25
Well you wouldn't know because you don't have the mental capacity to work as a programmer. Now go work your hourly shift you fucking stupid nigger.

Name: Anonymous 2011-11-19 20:29

>>25
I used to work as in fast food as my very first job when I was a young kid, and yes, YOU are required to clean the bathroom. Where I worked, there was a lady who would go out and always clean the dining room and bathroom, but when she was not there, others had to do it sometimes. I would always seem to disappearwhen it came to volunteers to cleaning the bathroom, so I never had to do it. But normally in the job interview they will ask you if you mind cleaning, because it is in the job description... Also, you jhaveto clean more than just the bathrooms... Once I seen a manager make another employee clean out the fryers.. GROSS!!!! I wanted to barf just watching... It was truly disgusting.

Name: Anonymous 2011-11-20 0:02

>>25
Assistant managers at the McDonalds near me make 40k to start. They don't even have to clean the toilets.

Name: Anonymous 2011-11-20 7:56

>>28
Go scrub another nigger, you mental nigger.

Name: Anonymous 2011-11-20 9:14

>>1
charArray[i] = (char)(i + 33);

Now watch as /prog/gers rage.

Name: Anonymous 2011-11-20 9:33

>>30
too late.

Name: Anonymous 2011-11-20 12:45

>>31
Ah, I see. Based on the last 5 replies, I couldn't figure it out that the problem has already been answered.

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