svnno****@sourc*****
svnno****@sourc*****
2009年 4月 8日 (水) 15:19:55 JST
Revision: 3182 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3182 Author: j5ik2o Date: 2009-04-08 15:19:55 +0900 (Wed, 08 Apr 2009) Log Message: ----------- リテラルを定数化しました。 Modified Paths: -------------- leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/StringUtil.java -------------- next part -------------- Modified: leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/StringUtil.java =================================================================== --- leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/StringUtil.java 2009-04-08 06:09:58 UTC (rev 3181) +++ leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/StringUtil.java 2009-04-08 06:19:55 UTC (rev 3182) @@ -29,6 +29,18 @@ */ public final class StringUtil { + private static final int C_8 = 8; + + private static final int C_16 = 16; + + private static final int C_24 = 24; + + private static final int C_0XFF = 0xff; + + private static final int C_0X0F = 0x0f; + + private static final int C_0XF0 = 0xf0; + private static final int CAMELIZE_BUFF_SIZE = 40; private static final int REPLACE_BUFF_SIZE = 100; @@ -44,8 +56,8 @@ * @param i 数値 */ public static void appendHex(final StringBuffer buf, final byte i) { - buf.append(Character.forDigit((i & 0xf0) >> 4, 16)); - buf.append(Character.forDigit((i & 0x0f), 16)); + buf.append(Character.forDigit((i & C_0X0F) >> 4, 16)); + buf.append(Character.forDigit(i & C_0XF0, 16)); } /** @@ -55,10 +67,10 @@ * @param i 数値 */ public static void appendHex(final StringBuffer buf, final int i) { - buf.append(Integer.toHexString((i >> 24) & 0xff)); - buf.append(Integer.toHexString((i >> 16) & 0xff)); - buf.append(Integer.toHexString((i >> 8) & 0xff)); - buf.append(Integer.toHexString(i & 0xff)); + buf.append(Integer.toHexString((i >> C_24) & C_0XFF)); + buf.append(Integer.toHexString((i >> C_16) & C_0XFF)); + buf.append(Integer.toHexString((i >> C_8) & C_0XFF)); + buf.append(Integer.toHexString(i & C_0XFF)); } /**