public static BigDecimal[] toDecimalArray(String name, Object value) {
    try {
      if (value instanceof BigDecimal[]) {
        return (BigDecimal[]) value;
      } else if (value instanceof double[]) {
        return Arrays.stream((double[]) value)
            .mapToObj(val -> new BigDecimal(String.valueOf(val)))
            .toArray(BigDecimal[]::new);
      } else if (value instanceof List) {
        return ((List<?>) value)
            .stream().map(d -> new BigDecimal(String.valueOf(d))).toArray(BigDecimal[]::new);
      } else {
        throw new MaestroInternalError(
            "Cannot cast value [%s] into a BigDecimal array for param [%s]",
            toTruncateString(value), name);
      }
    } catch (NumberFormatException nfe) {
      throw new MaestroInternalError(
          nfe, "Invalid number format for value: %s for param [%s]", toTruncateString(value), name);
    }
  }
@Test
  public void testDoubleArrayToDecimalArray() {
    Object val = new double[] {1.2, 3.4, 5.6};
    BigDecimal[] actual = ParamHelper.toDecimalArray("foo", val);
    assertEquals(1.2, actual[0].doubleValue(), 0.00000000);
    assertEquals(3.4, actual[1].doubleValue(), 0.00000000);
    assertEquals(5.6, actual[2].doubleValue(), 0.00000000);
  }