Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean flagaLosowania=false;
- boolean przecinek=false;
- boolean inneNizLiczba=false;
- for(int i=0;i<ciag.length();i++){
- if(ciag.charAt(i)==',' ){
- przecinek=true;
- }
- if(ciag.charAt(i)<48 || ciag.charAt(i)>57){
- inneNizLiczba=true;
- }
- }
- if(przecinek==false && inneNizLiczba==false){
- flagaLosowania=true;
- }
- int n = 0;
- if(flagaLosowania==true){
- Random random = new Random();
- if(ciag.isEmpty()==true){
- n=random.nextInt(15)+2;
- }else{
- n=Integer.parseInt(ciag);
- }
- java.text.DecimalFormat df=new java.text.DecimalFormat();
- df.setMaximumFractionDigits(2);
- ciag=String.valueOf((random.nextDouble()*100));
- for(int i=0;i<n-1;i++){
- ciag=ciag+","+String.valueOf((random.nextDouble()*100));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement