How to get the int value of the specified unicode character in Java

1 Answer

0 votes
package javaapplication1;
 
public class JavaApplication1 {
  
    public static void main(String[] args) {
         
        char ch = 'a';
        int i;

        i = Character.getNumericValue(ch);
        System.out.println(i);
        
        i = Character.getNumericValue('e');
        System.out.println(i);
        
        i = Character.getNumericValue('7');
        System.out.println(i);
    }
}
 
/*
run:

10
14
7
 
*/

 



answered Sep 13, 2016 by avibootz
...