public String generateValidTld(int length){
  StringBuffer buffer=new StringBuffer();
  for (int i=1; i <= length; i++) {
    char c=(char)('a' + Math.random() * 26);
    buffer.append(c);
  }
  String tempValidUrl=preUrl + buffer.toString();
  return tempValidUrl;
}

public String generateValidTld ( int length ) { StringBuffer buffer = new StringBuffer ( ) ; for ( int i = 1 ; i <= length ; i ++ ) { char c = ( char ) ( 'a' + Math . random ( ) * 26 ) ; buffer . append ( c ) ; } String tempValidUrl = preUrl + buffer . toString ( ) ; return tempValidUrl ; }
generate sample of valid tld .
