Adding two possitive numbers results a negative?

Hello everybody. I have a strange problem that it's racking my brain! i have the following codefor (int i=0;i<ascii.length;i++){

int randNum=rand.nextInt(100000000);

buffer[i]=randNum*256+ascii[i];

}

(ascii is an array of four integers that picture an ascii characters).

Normaly that would result a buffer full of positive numbers.In my case thats not always true. Many times i get as a result a negative number even if the other two numbers that i add are positive. What's wrong here? Thanks in advance!>

[711 byte] By [skywritera] at [2007-10-3 11:22:27]
# 1
Crossposted and answered. http://forum.java.sun.com/thread.jspa?threadID=791351Please don't post the same question multiple times. When you do, people may waste their time duplicating each others' answers, and the discussion becomes fragmented.
jverda at 2007-7-15 13:47:47 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...