RangeUtils { public static int getIntValueInRange(int fromRangeMin, int fromRangeMax, int toRangeMin, int toRangeMax, int fromRangeValue) { int oldRange = (fromRangeMax - fromRangeMin); int newRange = (toRangeMax - toRangeMin); return (((fromRangeValue - fromRangeMin) * newRange) / oldRange) + toRangeMin; }  static int getIntValueInRange(int fromRangeMin, int fromRangeMax, int toRangeMin,
      int toRangeMax, int fromRangeValue); static float getFloatValueInRange(float fromRangeMin, float fromRangeMax, float toRangeMin,
      float toRangeMax, float fromRangeValue);  }
@Test public void theValue50InTheOldRangeMustBe100OnTheNewRange(){ int fromMin = 0; int fromMax = 100; int toMin = 0; int toMax = 200; int result = RangeUtils.getIntValueInRange(fromMin, fromMax, toMin, toMax, 50); Assert.assertTrue(result == 100); }