I am kind of new in Java, and I got assigned some exercises. Any idea how to this small problem?
- create an array consisting of 100 random integers in the range 100 to 500, including the end points.
- make a method to print the array, 5 numbers per line, with a space between each.
- make a method to print the smallest number in the array.
So far this is what i got for the first 2 parts but i doesn't seem work, help please, sorry for asking such dumb questions...
package randomhundred;
import java.text.DecimalFormat;
public class RandomHundred {
public static void main(String[] args) {
//setting the 100 array
int rand [] = new int [100];
double numb;
DecimalFormat dec = new DecimalFormat("0");
for(int i=0; i<rand.length; i++){
numb = Math.random() * ( 500 - 100 );
}
}
public static int arai (){
return System.out.print(" " + dec.format(numb) + " ");
}
}