Wed Nov 03, 2010 8:47 pm
public int getAt(int index) {
if (index<0 || index>values[(values.length-1)]){
throw new IndexOutOfBoundsException();
}
int retValue = 0;
for(int i =0; i<values.length; i++){
if(values[i]==index){
retValue = values[index];
}
}
return retValue;
}
public boolean contains(int number) {
boolean retValue = false;
for(int i =0; i<values.length-1; i++){
if(values[i]==number){
retValue = true;
}else{
retValue = false;
}
}
return retValue;
}
Wed Nov 03, 2010 11:53 pm
public int getAt(int index) {
if (index<0 || index>(values.length-1)){
throw new IndexOutOfBoundsException();
}
int retValue = 0;
for(int i =0; i<values.length; i++){
if(i==index){
retValue = values[index];
}
}
return retValue;
}
Thu Nov 04, 2010 7:59 am
public boolean contains(int number) {
for(int i = 0; i < values.length - 1; i++){
if(values[i] == number){
return true;
}
}
return false;
}
|
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.