java.lang.Character isMirrored(int codePoint)

Description

The Character.isMirrored(int codePoint) java method determines whether the specified character (Unicode code point) is mirrored according to the Unicode specification. Mirrored characters should have their glyphs horizontally mirrored when displayed in text that is right-to-left. For example, ‘u0028’ LEFT PARENTHESIS is semantically defined to be an opening parenthesis. This will appear as a “(” in text that is left-to-right but as a “)” in text that is right-to-left.

The isMirrored(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.isMirrored(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 isMirrored() method non statically.

Method Syntax

public static boolean isMirrored(int codePoint))

Method Argument

Data Type Parameter Description
int codepoint the character (Unicode code point) to be tested.

Method Returns

The isMirrored(int codePoint) method of Character class returns true if the character is mirrored, false if the character is not mirrored or is not defined.

Compatibility

Requires Java 1.5 and up

Java Character isMirrored(int codePoint) Example

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

package com.javatutorialhq.java.examples;

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

public class CharacterIsMirroredCodepointExample {

	public static void main(String[] args) {
		
		/*
		 * ] is codepoint 93
		 * 
		 */
		
		// initialize a codepoint
		int codepoint = 93;
		
		/*
		 * check if the codepoint is mirrored 
		 * according to the Unicode specification
		 */
		boolean checkBool = Character.isMirrored(codepoint);
		
		// print result
		if(checkBool){
			System.out.print("Codepoint '"+codepoint 
					+ "' is mirrored");
		}
		else{
			System.out.print("Codepoint '"+codepoint 
					+ "' is not mirrored");
		}
		
	}

}

Sample Output

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

java Character isMirrored(int codepoint) example output