私はC/C++コードの現在の行を持っています:
double ma = *std::max_element(Dists[a], Dists[a] + size);
Dists[a]
サイズの倍長整数配列ですsize
int Dists[size][size];
同じ操作を実行するJavaの同等の関数を探しています。
「Dists[a]+ size」行のため、このC /C++関数がどのように機能するかわかりません。
Collections
実際の配列ではなく、を使用していると仮定します(これをお勧めします)。
ArrayList<Integer> a; // initialized somewhere
...
Collections.max(a);
実際の2次元配列を使用している場合は、次を試してください。
int[][] c; // initialized somewhere
int i; // set somewhere
List b = Arrays.asList(ArrayUtils.toObject(c[i]));
Collections.max(b);
要素は、を使用しnatural ordering
て比較されます。