// returns factor static double normalizeShortArrays(L l) { int max = min(32767, absShortMax_multipleArrays(l)); if (max == 0 || max == 32767) ret 1; double factor = 32767.0/max; for (short[] a : l) for i over a: a[i] = roundToShort(a[i]*factor); ret factor; }