How to generate any random number of any Length in Java? Like, to generate a number of width 3, it should be between 100 to 999. So how to code this?
In image below:

I want to solve second problem.
This is what I written for first problem:  
public int getRandomNumberReturntypediff(int min,int max) {
    Random rand = new Random();
    int  n = rand.nextInt(1000) + 1;
    Integer.toString(n);
    System.out.println("get Random Number with return type STRING" + n);
    return n;
}
Suppose I take parameter length and return String. How can I do this?
 
     
     
     
     
     
     
    