为了账号安全,请及时绑定邮箱和手机立即绑定

乱码- -

public char getRandomChar(){

String str ="";

int hightpos; 

int lowpos;

Random random = new Random();

hightpos = (176+Math.abs((random.nextInt(39))));

lowpos =(161+ Math.abs((random.nextInt(93))));

byte b[] =new byte[2];

b[0] = (Integer.valueOf(hightpos)).byteValue();

b[1] = (Integer.valueOf(lowpos)).byteValue();

try {

str =new String(b,"GBK");

} catch (UnsupportedEncodingException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return str.charAt(0);

}


正在回答

1 回答

解决了没?你检查下你的那个项目的编码是什么格式的?你换成GBK试试

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Android猜歌游戏是这样炼成的
  • 参与学习       27729    人
  • 解答问题       433    个

手把手教你完成一款猜歌类游戏,向你展示游戏实现的全部细节

进入课程
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号