Java Character isLowSurrogate() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
java.lang.Character

Definition

In Java, Character.isLowSurrogate(ch) returns true when the char is a low surrogate (also called a trailing surrogate): a value from 0xDC00 to 0xDFFF. It is the second half of a pair that encodes a character above U+FFFF.

If you find a low surrogate at an index, you are standing in the middle of a character. That matters when cutting strings, moving a cursor, or starting a loop at an arbitrary index.

A static method of java.lang.Character (Java 5+): call it on the class, as in Character.isLowSurrogate(...); you do not need a Character object. No import is needed, because java.lang is always available.

Syntax

Pass one char.

Java
Character.isLowSurrogate('\uDE00');   // true, second half of U+1F600
Character.isLowSurrogate('\uD83D');   // false, that is a high surrogate
Character.isLowSurrogate('z');        // false
Character.isLowSurrogate('\uE000');   // false, just past the range
CallWhat it does
Character.isLowSurrogate(s.charAt(i))Is index i inside a character?
if (Character.isLowSurrogate(s.charAt(begin))) begin--;Move a start index back to the beginning of a character.
c >= Character.MIN_LOW_SURROGATE && c <= Character.MAX_LOW_SURROGATEThe range check written out.

One overload, isLowSurrogate(char ch), since Java 5. Range constants: Character.MIN_LOW_SURROGATE and Character.MAX_LOW_SURROGATE.

Library declarations
Java
// java.lang.Character (since Java 5)
public static boolean isLowSurrogate(char ch)

public static final char MIN_LOW_SURROGATE = '\uDC00';
public static final char MAX_LOW_SURROGATE = '\uDFFF';

Parameters

ParameterDescription
ch (char)The char to test.

Return Value

Return ValueDescription
truech is from 0xDC00 to 0xDFFF.
falseAny other char, including high surrogates.

Compare with Similar Methods

The surrogate family:

MethodHow it differs
isHighSurrogate(ch)The first half: 0xD800 to 0xDBFF.
isSurrogate(ch)Either half (Java 7+).
lowSurrogate(cp)Computes the low surrogate of a code point (Java 7+).

Java Examples

Example 1 — The Low Surrogate Range and Its Edges

Test the last high surrogate, three low surrogates, the first private use char, and a letter.

Java
public class CharacterIsLowSurrogateTable {
    public static void main(String[] args) {
        char[] chars = {'\uDBFF', '\uDC00', '\uDE00', '\uDFFF', '\uE000', 'z'};
        for (char c : chars) {
            System.out.println("0x" + Integer.toHexString(c) + " low=" + Character.isLowSurrogate(c));
        }
    }
}

How It Works

  1. Right after the high range. 0xDBFF is the last high surrogate; the low range starts at 0xDC00.
  2. Up to 0xDFFF. 0xDC00, 0xDE00 (the emoji's second half), and 0xDFFF are low surrogates.
  3. Outside. 0xE000 begins the private use area, and 'z' (0x7a) is an ordinary letter.

Example 2 — Find Which Indexes Are Inside a Character

Label every index of a string as the start of a character or the middle of a pair, then fix a start index that lands in the middle.

Java
public class CharacterIsLowSurrogatePositions {
    public static void main(String[] args) {
        String s = "x\uD83D\uDE00y";
        for (int i = 0; i < s.length(); i++) {
            boolean inside = Character.isLowSurrogate(s.charAt(i));
            System.out.println(i + (inside ? " inside a pair" : " starts a character"));
        }
        int begin = 2;
        if (Character.isLowSurrogate(s.charAt(begin))) {
            begin--;
        }
        System.out.println("safe begin: " + begin);
    }
}

How It Works

  1. Index 2 is special. It holds 0xDE00, the second half of the emoji, so it is the only index where a character does not start.
  2. Move back one. A substring or cursor that begins at 2 would start with half a character; stepping back to 1 includes the whole pair.
  3. Index 1 is fine. It holds the high surrogate, which is where the emoji begins.

Example 3 — Remove Low Surrogates That Have No High Surrogate

Corrupted text starts with a stray low surrogate. Keep pairs, drop the stray one.

Java
public class CharacterIsLowSurrogateStray {
    public static void main(String[] args) {
        String s = "\uDE00ab\uD83D\uDE00";
        StringBuilder clean = new StringBuilder();
        int removed = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            boolean afterHigh = i > 0 && Character.isHighSurrogate(s.charAt(i - 1));
            if (Character.isLowSurrogate(c) && !afterHigh) {
                removed++;
            } else {
                clean.append(c);
            }
        }
        System.out.println("removed=" + removed + " length=" + clean.length()
                + " codePoints=" + clean.codePointCount(0, clean.length()));
    }
}

How It Works

  1. A stray at index 0. The first char is 0xDE00 with nothing before it, so afterHigh is false and the char is removed.
  2. A proper pair survives. The second 0xDE00 follows 0xD83D, so afterHigh is true and it is kept.
  3. Result. a, b, and the complete emoji remain: 4 chars that form 3 code points.

Frequently Asked Questions

A char from 0xDC00 to 0xDFFF. It is the second of the two chars UTF-16 uses for a code point above U+FFFF.
Index i is in the middle of a character. The character starts at i - 1, if that char is a high surrogate.
Java allows it, because Strings are just sequences of chars, but such a String is malformed UTF-16 and will not encode cleanly.
No. Most chars are neither. Only 0xDC00 to 0xDFFF are low surrogates.
Constants in Character for the range ends, \uDC00 and \uDFFF.

Next: isMirrored()

Check whether a character's glyph is flipped in right-to-left text, like brackets.

isMirrored() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful