diff options
author | Jonathan Bluett-Duncan <jbluettduncan@gmail.com> | 2017-07-12 00:09:41 -0700 |
---|---|---|
committer | Gary Gregory <ggregory@apache.org> | 2017-07-12 00:09:41 -0700 |
commit | 1571050a196198f336ae487ee3b6df629d3ee9da (patch) | |
tree | 991e0ade630b40207a02f3b16e703187c99d0d2e /src/main/java/org/apache/commons/lang3/CharUtils.java | |
parent | a37d19eb45d76cd6ab4e2c8fa9fc156bf7be97db (diff) | |
download | apache-commons-lang-1571050a196198f336ae487ee3b6df629d3ee9da.tar.gz |
[GitHub] commons-lang pull request #276: IntelliJ IDEA refactorings.
Closes #276.
Diffstat (limited to 'src/main/java/org/apache/commons/lang3/CharUtils.java')
-rw-r--r-- | src/main/java/org/apache/commons/lang3/CharUtils.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/java/org/apache/commons/lang3/CharUtils.java b/src/main/java/org/apache/commons/lang3/CharUtils.java index 51b347a96..219dea2a0 100644 --- a/src/main/java/org/apache/commons/lang3/CharUtils.java +++ b/src/main/java/org/apache/commons/lang3/CharUtils.java @@ -218,7 +218,7 @@ public class CharUtils { * @throws IllegalArgumentException if the character is not ASCII numeric */ public static int toIntValue(final char ch) { - if (isAsciiNumeric(ch) == false) { + if (!isAsciiNumeric(ch)) { throw new IllegalArgumentException("The character " + ch + " is not in the range '0' - '9'"); } return ch - 48; @@ -240,7 +240,7 @@ public class CharUtils { * @return the int value of the character */ public static int toIntValue(final char ch, final int defaultValue) { - if (isAsciiNumeric(ch) == false) { + if (!isAsciiNumeric(ch)) { return defaultValue; } return ch - 48; @@ -351,13 +351,11 @@ public class CharUtils { * @return the escaped Unicode string */ public static String unicodeEscaped(final char ch) { - final StringBuilder sb = new StringBuilder(6); - sb.append("\\u"); - sb.append(HEX_DIGITS[(ch >> 12) & 15]); - sb.append(HEX_DIGITS[(ch >> 8) & 15]); - sb.append(HEX_DIGITS[(ch >> 4) & 15]); - sb.append(HEX_DIGITS[(ch) & 15]); - return sb.toString(); + return "\\u" + + HEX_DIGITS[(ch >> 12) & 15] + + HEX_DIGITS[(ch >> 8) & 15] + + HEX_DIGITS[(ch >> 4) & 15] + + HEX_DIGITS[(ch) & 15]; } /** |