Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This program creates an array of randomized numbers. It sets them in order, then reverses the order.
- import java.util.Random;
- public class Main {
- public static void main(String[] args) {
- Banner();
- Random Rand= new Random();
- int num1= Rand.nextInt(10)+1;
- int num2= Rand.nextInt(10)+1;
- int num3= Rand.nextInt(10)+1 ;
- int [] come={num1, num2, num3};
- for(int i=0; i<3; i++){
- System.out.println(come[i]);
- }
- System.out.println("Array length: "+ come.length);
- System.out.println("Setting the array in the reverse order: ");
- for(int i=2; i>-1;i--){
- System.out.println(come[i]);
- }
- }
- public static void Banner(){
- System.out.println("Malachi Sor Random Numbers in a array\n-------------------\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment