Character.isSupplementaryCodePoint() Method in Java

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

// 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);
    }
}

chevron_right


Output:

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

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

// 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);
    }
}

chevron_right


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)

Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.