How to get the code point at the given index of char array in Java

1 Answer

0 votes
package javaapplication1;

public class JavaApplication1 {
 
    public static void main(String[] args) {
        
        String str = "Java Programming";
   
        int cp = str.codePointAt(1);
        
        // codePointAt(char[] a, int index)
        System.out.println(cp);
        System.out.println(str.codePointAt(5));
    }
}
 
/*
run:

97
80
 
*/

 



answered Sep 12, 2016 by avibootz
edited Sep 12, 2016 by avibootz
...