private static int convert(double newRange, double oldValue, double oldRange) {
    return (int)(.5 + newRange * oldValue / oldRange);
  }
private static int convert(double newRange, double oldValue, double oldRange)