import java.util.*;

public class RandTest{
	public static void main(String argv[]){
		Random g1; // from java.util
		boolean fla = false;
		
		int ahold[];
		int bus[] = {12, 11, 12 , 24, 24, 67, 54, 12, 31, 24};
		
		ahold = new int[12];
		
		g1= new Random();
		for(int i = 0; i < ahold.length; i++){
			ahold[i] = -40 + g1.nextInt(80);
			System.out.println(ahold[i]);
		}
		
		// check for two adjoining doubles
		
		for(int j = 0; j < bus.length-1; j++){
			if(bus[j]==bus[j+1]){
				fla = true;
				break;
			}
		}
		if(fla == true)
		    System.out.println("There were adjoining doubles");
		else
		    System.out.println("No adjoining doubles found");
		
	}
}

    Source: geocities.com/dvshah