所以即时通讯创建这个函数必须找到一个字符数组的整数平均值。查找字符数组中的整数平均值
这是我的数组char [] letters = {'A','B','C','D','E','F','G','H','I', 'J'};
我试图通过类型转换来找到像A = 32 j = 74这样的整数平均值。将整数值加回来并将其转回到一个字符中,但此时卡住了。
/********************************************************************************
This function will calculate the integer average of characters in the array
********************************************************************************/
public static void average(char [] letters)
{
int total = 0;
char mean;
total = total + letters[letters.length];
mean = (char)total/letters.length;
System.out.println("The value is " + average(letters));
}
你是否支持ISO-LATIN-1或Unicode中的重音字符? –
很好使用unicode – javip
你不能在字符中存储Unicode。 –