Java - Change int to ascii

前端 未结 7 906
迷失自我
迷失自我 2020-12-01 07:32

Is there a way for java to convert int\'s to ascii symbols?

7条回答
  •  情歌与酒
    2020-12-01 08:12

    You can convert a number to ASCII in java. example converting a number 1 (base is 10) to ASCII.

    char k = Character.forDigit(1, 10);
    System.out.println("Character: " + k);
    System.out.println("Character: " + ((int) k));
    

    Output:

    Character: 1
    Character: 49
    

提交回复
热议问题