I am trying to create a random phone number with a range. The format being (xxx)-xxx-xxx and the area code not starting with 0,8, or 9 and the next set of three being in a range from 100-742 and then the last set of 4 can be any digit. How would i create the first two parts? Any help would be appreciated. Thanks!
import java.util.*;
import java.text.*;
public class PhoneNumber{
    public static void main(String[] arg){
        Random ranNum = new Random();
        //int areaCode = 0;
        //int secSet = 0;
        //int lastSet = 0;
        DecimalFormat areaCode = new DecimalFormat("(000)");
        DecimalFormat secSet = new DecimalFormat("-000");
        DecimalFormat lastSet = new DecimalFormat("-0000");
        //DecimalFormat phoneNumber = new DecimalFormat("(###)-###-####");
        int i = 0;
        //areaCode = (ranNum.nextInt()); //cant start with 0,8,9
        //secSet = (ranNum.nextInt()); // not greater than 742 and less than 100
        //lastSet = (ranNum.nextInt(999)) + 1; // can be any digits
        i = ranNum.nextInt();
        System.out.print(areaCode.format(i));
        i = ranNum.nextInt();
        System.out.print(secSet.format(i));
        i = ranNum.nextInt();
        System.out.print(lastSet.format(i));
    }
}
 
     
     
     
     
    