List of utility methods to do Boolean From
boolean | toBoolean(String value, boolean defaultValue) convert the string to a boolean, returning the default value if null if (value == null) { return defaultValue; return Boolean.valueOf(value).booleanValue(); |
Boolean | toBoolean(String value, boolean defaultValue) to Boolean if (isEmpty(value)) return defaultValue; try { return Boolean.parseBoolean(value); } catch (Exception e) { return defaultValue; |
boolean | toBoolean(String value, boolean defaultValue) to Boolean if (!defaultValue) { if (value == null) return defaultValue; else if (value.equalsIgnoreCase("true")) return true; else if (value.equalsIgnoreCase("yes")) return true; else if (value.equalsIgnoreCase("on")) ... |
Boolean | toBoolean(StringBuilder value) to Boolean return Boolean.getBoolean(value.toString());
|
boolean[] | toBooleanA(byte[] data) to Boolean A if (data == null || data.length < 4) return null; int len = toInt(new byte[] { data[0], data[1], data[2], data[3] }); boolean[] bools = new boolean[len]; for (int i = 0, j = 4, k = 7; i < bools.length; i++) { bools[i] = ((data[j] >> k--) & 0x01) == 1; if (k < 0) { j++; ... |
void | toBooleanArray(byte a, boolean[] buf) Turns the requested byte into a binary based boolean array with a length of 8. buf[0] = (a & 128) == 128; buf[1] = (a & 64) == 64; buf[2] = (a & 32) == 32; buf[3] = (a & 16) == 16; buf[4] = (a & 8) == 8; buf[5] = (a & 4) == 4; buf[6] = (a & 2) == 2; buf[7] = (a & 1) == 1; ... |
boolean[] | toBooleanArray(byte[] array) Coverts given bytes array to array of booleans. boolean[] result = new boolean[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i] > 0; return result; |
boolean[] | toBooleanArray(byte[] byteArray) to Boolean Array if (byteArray == null || byteArray.length < 4) return null; int len = toInt(new byte[] { byteArray[0], byteArray[1], byteArray[2], byteArray[3] }); boolean[] bools = new boolean[len]; for (int i = 0, j = 4, k = 7; i < bools.length; i++) { bools[i] = ((byteArray[j] >> k--) & 0x01) == 1; if (k < 0) { j++; ... |
boolean[] | toBooleanArray(byte[] data) to Boolean Array if ((data == null) || (data.length < 4)) { return null; int len = toInt(new byte[] { data[0], data[1], data[2], data[3] }); boolean[] bools = new boolean[len]; for (int i = 0, j = 4, k = 7; i < bools.length; i++) { bools[i] = ((data[j] >> k--) & 0x01) == 1; if (k < 0) { ... |
boolean[] | toBooleanArray(final E[] array) to Boolean Array boolean[] stringList = null; if (array != null) { stringList = new boolean[array.length]; for (int i = 0; i < array.length; i++) { if (array[i] != null) { try { stringList[i] = "true".equalsIgnoreCase(array[i].toString().trim()) || "1".equals(array[i].toString().trim()); ... |