Open In App

Character.isSupplementaryCodePoint() Method in Java

Last Updated : 06 Dec, 2018
Improve
Improve
Like Article
Like
Save
Share
Report

The java.lang.Character.isSupplementaryCodePoint(int codePoint) is an inbuilt method in java that determines whether the specified character (Unicode code point) is in the supplementary character range.

Syntax:

public static boolean isSupplementaryCodePoint(int codePoint)

Parameters: The codePoint of integer type refers to the character (Unicode code point) that is to be tested.

Return Value: This method returns true if the specified code point is between MIN_SUPPLEMENTARY_CODE_POINT and MAX_CODE_POINT inclusive, false otherwise.

Below programs illustrate the Character.isSupplementaryCodePoint() method:

Program 1:




// Code to illustrate the isSupplementaryCodePoint() method
import java.lang.*;
  
public class gfg {
  
    public static void main(String[] args)
    {
  
        // Create 2 int primitives c1, c2 and assign values
        int c1 = 0x10ffd, c2 = 0x154ca;
  
        boolean bool1 = Character.isSupplementaryCodePoint(c1);
        boolean bool2 = Character.isSupplementaryCodePoint(c2);
  
        String str1 = "c1 represents a supplementary code point is " + bool1;
        String str2 = "c2 represents a supplementary code point is " + bool2;
  
        // Displaying the result
        System.out.println(str1);
        System.out.println(str2);
    }
}


Output:

c1 represents a supplementary code point is true
c2 represents a supplementary code point is true

Program 2:




// Code to illustrate the isSupplementaryCodePoint() method
import java.lang.*;
  
public class gfg {
  
    public static void main(String[] args)
    {
  
        // Creates 2 int primitives c1, c2 and assign values
        int c1 = 0x45ffd, c2 = 0x004ca;
  
        boolean bool1 = Character.isSupplementaryCodePoint(c1);
        boolean bool2 = Character.isSupplementaryCodePoint(c2);
  
        String str1 = "c1 represents a supplementary code point is " + bool1;
        String str2 = "c2 represents a supplementary code point is " + bool2;
         
        // Displaying the result
        System.out.println(str1);
        System.out.println(str2);
    }
}


Output:

c1 represents a supplementary code point is true
c2 represents a supplementary code point is false

Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isSupplementaryCodePoint(int)



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads