これを翻訳する方法を知る必要があります:
次のような Java プロセスに変換します。
public static float computeAverage(float [] i){
//I have no idea what this is supposed to be.
}
またはおそらく
public static double computeAverage(double [] i){
//Still have no idea what this is meant to be.
}
double の方が簡単に答えられるのであればそれで問題ありませんが、そのレベルの精度は本当に必要ありません。
*編集:*わかりました、これが正しいかどうか教えてください:
public static float computeAverage(float [] i){
float tally = 0f;
for(int x=0;x<i.length;x++){
tally = tally + pValue(i[x]);
}
return tally / i.length;
}
public static float pValue(float i){
return 2 - 1f/i;
}