Java Character example to get ASCII or unicode value of the character using codePointAt

public static int codePointAt(char[] a,int index)

Returns the code point at the given index of the char array. If the char value at     the given index in the char array is in the high-surrogate range, the following     index is less than the length of the char array, and the char value at the     following index is in the low-surrogate range, then the supplementary code     point corresponding to this surrogate pair is returned. Otherwise, the char value     at the given index is returned


package com.candidjava;

public class CharacterCodePointAt
public static void main(String[] args)
char[] c ={ 'a', 'b', 'c', 'd', 'e' };
int res, index = 0;
res = Character.codePointAt(c, index);

String str = "Unicode code point is " + res;
System.out.println( str );


    Unicode code point is 97


This method returns the Unicode code point at the given index.   


    a - the char array
    index - the index to the char values (Unicode code units) in the char array to be     converted

    the Unicode code point at the given index

    NullPointerException - if a is null.
    IndexOutOfBoundsException - if the value index is negative or not less than the     length of the char array.