java.lang.Character lowSurrogate(int codePoint)

Description

The Character.lowSurrogate(int codePoint) java method returns the trailing surrogate (a low surrogate code unit) of the surrogate pair representing the specified supplementary character (Unicode code point) in the UTF-16 encoding. If the specified character is not a supplementary character, an unspecified char is returned.

If isSupplementaryCodePoint(x) is true, then isLowSurrogate(lowSurrogate(x)) and toCodePoint(highSurrogate(x), lowSurrogate(x)) == x are also always true.

The lowSurrogate(int codePoint) method of Character class is static thus it should be accessed statically which means the we would be calling this method in this format:

Character.lowSurrogate(int codePoint)

Non static method is usually called by just declaring method_name(argument) however in this case since the method is static, it should be called by appending the class name as suffix. We will be encountering a compilation problem if we call the java lowSurrogate() method non statically.

Method Syntax

public static char lowSurrogate(int codePoint)

Method Argument

Data Type Parameter Description
int codepoint a supplementary character (Unicode code point)

Method Returns

The lowSurrogate(int codePoint) method of Character class returns the trailing surrogate code unit used to represent the character in the UTF-16 encoding.

Compatibility

Requires Java 1.7 and up

Java Character lowSurrogate(int codePoint) Example

Below is a simple java example on the usage of lowSurrogate(int codePoint) method of Character class.

package com.javatutorialhq.java.examples;

/*
 * This example source code demonstrates the use of 
 * lowSurrogate(int codePoint) method of Character class.
 */

public class CharacterLowSurrogateExample {

	public static void main(String[] args) {
		
		// initialize codepoints
		int codepoint1 = 65808;
		int codepoint2 = 15672;
		
		// get the trailing surrogate
		char result1 = Character.lowSurrogate(codepoint1);
		char result2 = Character.lowSurrogate(codepoint2);
		
		// print the result
		System.out.println("The trailing surrogate of "+codepoint1 +
				" is "+result1);
		System.out.println("The trailing surrogate of "+codepoint2 +
				" is "+result2);

	}

}

Sample Output

Below is the sample output when you run the above example.

java Character lowSurrogate(int codePoint) example output