各列の最大値を検索したら、新しい配列にどのように値を追加するのですか?新しい列に見つかった最大値を新しい配列に追加する(java)
double cur[][] ={
{ 0, 0.25, 0.5},
{ 0.5, 0.75, 1},
{ 0.75, 1, 1},
{ 0, 0.25, 0.5},
{ 0.25, 0.5, 0.75},
{ 0, 0, 0.25},
{ 0.5, 0.75, 1}
};
public void max1() {
for (int i = 0; i < cur[0].length; i++) { // i should be your column
double max = cur[0][i];// assign 1st value of the column as max
for (int j = 0; j < cur.length; j++){ // j is your row
if (cur[j][i] > max){ // check the column elements instead of row elements
max = cur[j][i];// get the column values
}
}
}
}
あなたの質問はどのようにネットビーンズに関連していますか? –
メソッドの型を変更する必要がありますので、voidではなくdouble [] []を返します。 – dave
私はnetbeansを使用してJavaアプリケーションをコードします。 – DonQuixote