package dslog; import java.io.InputStream; class Util { public static int[] concat(int[]... lists) { int len = 0; for (int[] list : lists) { len += list.length; } int[] ret = new int[len]; int n = 0; for (int[] list : lists) { System.arraycopy(list, 0, ret, n, list.length); n += list.length; } return ret; } public static int[] reverse(int[] list) { int mid = list.length / 2; int tmp; for (int i = 0; i < mid; i++) { tmp = list[i]; list[i] = list[list.length - i - 1]; list[list.length - i - 1] = tmp; } return list; } public static double unpack(short val, int whole, int frac) { switch (whole + frac) { case 8: case 10: break; default: throw new IllegalArgumentException(whole+"+"+frac+" != 8|10"); } return val / Math.pow(2, frac); } public static double unpack(int val, int whole, int frac) { switch (whole + frac) { case 16: break; default: throw new IllegalArgumentException(whole+"+"+frac+" != 16"); } return val / Math.pow(2, frac); } }