hej
hej
Posted in Text, on January 25, 2012 at 03:00
Posted in Text, on January 25, 2012 at 03:00
public class Randomarray {
private int []random;
//konstrukor
public Randomarray(){
random=new int[10];
for(int i=0;i<random.length;i++)
random [i]=(int)(Math.random()*100);
}
public Randomarray(int n){
random=new int[10];
for(int i=0;i<random.length;i++)
random [i]=(int)(Math.random()*100);
}
public String toString(){
String out="";
for(int i=0;i<random.length;i++)
out+=random[i]+" ";
return out;
}
public int getMax(){
int max=random[0];
for(int i=1;i<random.length;i++)
if (random[i]>max)
max=random[i];
return max;
}
public int getMin(){
int min=random[0];
for(int i=1;i<random.length;i++)
if (random[i]<min)
min=random[i];
return min;
}
}
Share this code
Use the link below to share the code:
http://www.codesend.com/view/e4c77ddff3e7894d100345f284faf7b1/
HTML
<a href="http://www.codesend.com/view/e4c77ddff3e7894d100345f284faf7b1/">hej</a>
BBCode
[url=http://www.codesend.com/view/e4c77ddff3e7894d100345f284faf7b1/]hej[/url]
© 2010 CodeSend.com - send code quick and easy
Syntax highlighting by Alex Gorbatchev
Syntax highlighting by Alex Gorbatchev
