public static double[] toDoubleArray(String name, Object value) {
    try {
      if (value instanceof BigDecimal[]) {
        return Arrays.stream((BigDecimal[]) value).mapToDouble(BigDecimal::doubleValue).toArray();
      } else if (value instanceof double[]) {
        return (double[]) value;
      } else if (value instanceof List) {
        return ((List<?>) value)
            .stream().mapToDouble(d -> new BigDecimal(String.valueOf(d)).doubleValue()).toArray();
      } else {
        throw new MaestroInternalError(
            "Param [%s] has an invalid evaluated result [%s]", name, toTruncateString(value));
      }
    } catch (NumberFormatException nfe) {
      throw new MaestroInternalError(
          nfe,
          "Invalid number format for evaluated result: %s for param [%s]",
          toTruncateString(value),
          name);
    }
  }
@Test
  public void testDoubleArrayToDoubleArray() {
    double[] val = new double[] {1.2, 3.4, 5.6};
    double[] actual = ParamHelper.toDoubleArray("foo", val);
    assertArrayEquals(val, actual, 0.00001);
  }