if (ArrayUtils.isSameLength(classArray, toClassArray) == false) { return false;
/** * 字符串起始长度<code>length</code>的字符串是否包含中文 * * @param message * @param length * @return */ public static boolean isContainChinese(String message, int length) { char[] chars = StringUtil.substrings(message, 0, length).toCharArray(); char[] charsPlus = StringUtil.substrings(message, 0, length + 1).toCharArray(); return ArrayUtils.isSameLength(chars, charsPlus); }
private static boolean verifySig(byte[] sig, String deviceId, int portNum, long timestamp, String secret) { byte[] nsig = createSig(deviceId, portNum, timestamp, secret); if (nsig == null) { return false; } if (!ArrayUtils.isSameLength(nsig, sig)) { return false; } boolean fail = false; for (int i = 0; i < nsig.length; i++) { if (sig[i] != nsig[i]) { fail = true; } } if (fail) { return false; } return true; }
/** * 字符串起始长度<code>length</code>的字符串是否包含中文 * * @param message * @param length * @return */ public static boolean isContainChinese(String message, int length) { char[] chars = StringUtil.substrings(message, 0, length).toCharArray(); char[] charsPlus = StringUtil.substrings(message, 0, length + 1).toCharArray(); return ArrayUtils.isSameLength(chars, charsPlus); }
if (ArrayUtils.isSameLength(classArray, toClassArray) == false) { return false;
if (ArrayUtils.isSameLength(classArray, toClassArray) == false) { return false;
if (ArrayUtils.isSameLength(classArray, toClassArray) == false) { return false;
if (ArrayUtils.isSameLength(classArray, toClassArray) == false) { return false;
if (ArrayUtils.isSameLength(classArray, toClassArray) == false) { return false;
/** * Hand-crafted SID. */ @Test public void testConvertHandCraftedStringSidToBinary() throws Exception { byte[] expectedSid = {(byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x15, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00}; byte[] result = LdapUtils.convertStringSidToBinary("S-1-5-21-1-2-3-4"); assertThat(ArrayUtils.isSameLength(expectedSid, result)).isTrue(); for (int i = 0; i < result.length; i++) { assertThat(expectedSid[i]).isEqualTo(result[i]); } }
/** * Example SID from "http://www.pcreview.co.uk/forums/thread-1458615.php". */ @Test public void testConvertStringSidToBinary() throws Exception { byte[] expectedSid = {(byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x15, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xe9, (byte) 0x67, (byte) 0xbb, (byte) 0x98, (byte) 0xd6, (byte) 0xb7, (byte) 0xd7, (byte) 0xbf, (byte) 0x82, (byte) 0x05, (byte) 0x1e, (byte) 0x6c, (byte) 0x28, (byte) 0x06, (byte) 0x00, (byte) 0x00}; byte[] result = LdapUtils.convertStringSidToBinary("S-1-5-21-2562418665-3218585558-1813906818-1576"); assertThat(ArrayUtils.isSameLength(expectedSid, result)).as("incorrect length of array").isTrue(); for (int i = 0; i < result.length; i++) { assertThat(expectedSid[i]).isEqualTo(result[i]); } }