I am building a java function that takes a 2D array and also returns a 2D array. This function filters some elements from the input function. In this case its an array of Strings and it filters the elements that have its second element as 0. For example: If I have the array
{{"one", "0.0"}, {"two", "2.4"}, {"three", "0.0"}, {"four", "2.3"}}
then I will get
{{"two","2.4"},{"four","2.3"}}
I have this but it does not work
public String[][] getArrayNoZero(String[][]s){
String [] result;
for(int i=0; i<s.length; i++){
if(float(s[i][1])>0){
String []tempArray= {s[i][0],s[i][1]};
result.append(tempArray);
}
}
return result;
}
Thanks