public static int bytesBE2ushort(byte[] b, int off) { return bytesBE2sshort(b, off) & 0xffff; }
public static short[] bytesBE2shorts(byte[] b) { if (b == null) return null; if ((b.length & 0x1) != 0) throw new IllegalArgumentException("byte[" + b.length + "]"); short[] val = new short[b.length >> 1]; for (int i = 0; i < val.length; i++) val[i] = (short) bytesBE2sshort(b, i << 1); return val; }
public static int[] bytesBE2sshorts(byte[] b) { if (b == null) return null; if ((b.length & 0x1) != 0) throw new IllegalArgumentException("byte[" + b.length + "]"); int[] val = new int[b.length >> 1]; for (int i = 0; i < val.length; i++) val[i] = bytesBE2sshort(b, i << 1); return val; }
@Override public int toInt(byte[] val, boolean bigEndian) { if (val == null || val.length == 0) return 0; return bigEndian ? ByteUtils.bytesBE2sshort(val, 0) : ByteUtils.bytesLE2sshort(val, 0); }
public static Map<String, Object> bytesBE2shortsWithMinMax(byte[] b) { HashMap<String, Object> ret = new HashMap<String, Object>(3); if (b == null) return null; if ((b.length & 0x1) != 0) throw new IllegalArgumentException("byte[" + b.length + "]"); short min = ((short) bytesBE2sshort(b, 0)), max = ((short) bytesBE2sshort(b, 0)); short[] val = new short[b.length >> 1]; for (int i = 0; i < val.length; i++) { val[i] = (short) bytesBE2sshort(b, i << 1); min = min(min, val[i]); max = max(max, val[i]); } ret.put(MAP_DATA, val); ret.put(MAP_MIN, new Short(min)); ret.put(MAP_MAX, new Short(max)); return ret; }
? ByteUtils.bytesBE2sshort(val, i) : ByteUtils.bytesLE2sshort(val, i)); int sl = s.length();