public
synchronized int codePointBefore(int index)
Returns
the character (Unicode code point) before the specified index. The
index refers to char values (Unicode code units) and ranges from 1 to
length()
public class StringBufferCodePointBefore { public static void main(String args[]){ int arr[] = {65536, 65537, 65538}; String s = new String(arr, 0, arr.length); StringBuffer str = new StringBuffer(s); for(int i=1; i<str.length()+1; i++){ System.out.print("Code point before index " + i +" is "); System.out.println(str.codePointBefore(i)); } } }
Output
Code point before index 1 is 55296 Code point before index 2 is 65536 Code point before index 3 is 55296 Code point before index 4 is 65537 Code point before index 5 is 55296 Code point before index 6 is 65538
No comments:
Post a Comment