@Test public void keepGivenDecimalNumber() { Number d = 1.5678; Assert.assertEquals(FeatureBinsUtil.keepGivenDecimal(d, 3).toString(), "1.568"); d = 233421L; Assert.assertEquals(FeatureBinsUtil.keepGivenDecimal(d, 3).toString(), "233421"); }
public static Double keepGivenDecimal(Double d, int decimal) { if (null == d) { return null; } BigDecimal bigDecimal = new BigDecimal(d); return bigDecimal.setScale(decimal, BigDecimal.ROUND_HALF_UP).doubleValue(); }
FeatureBinsUtil { public static Double keepGivenDecimal(Double d, int decimal) { if (null == d) { return null; } BigDecimal bigDecimal = new BigDecimal(d); return bigDecimal.setScale(decimal, BigDecimal.ROUND_HALF_UP).doubleValue(); } }
FeatureBinsUtil { public static Double keepGivenDecimal(Double d, int decimal) { if (null == d) { return null; } BigDecimal bigDecimal = new BigDecimal(d); return bigDecimal.setScale(decimal, BigDecimal.ROUND_HALF_UP).doubleValue(); }  }
FeatureBinsUtil { public static Double keepGivenDecimal(Double d, int decimal) { if (null == d) { return null; } BigDecimal bigDecimal = new BigDecimal(d); return bigDecimal.setScale(decimal, BigDecimal.ROUND_HALF_UP).doubleValue(); }  static BinTypes.ColType featureTypeToColType(String featureType, BinDivideType binDivideType); static String getTypeString(TypeInformation<?> type); static TypeInformation<?> getFlinkType(String typeStr); static Double keepGivenDecimal(Double d, int decimal); static Number keepGivenDecimal(Number d, int decimal); static DataSet<FeatureBinsCalculator> parseFeatureBinsModel(DataSet<Row> modelData); static int compareNumbers(Number o1, Number o2); static FeatureBinsCalculator[] deSerialize(String str); static String serialize(FeatureBinsCalculator... featureBinsCalculators); static double calcWoe(long binTotal, long binPositiveTotal, long positiveTotal, long negativeTotal); static long nullIndex(int normBinSize); static long elseIndex(int normBinSize); static int getBinEncodeVectorSize(FeatureBinsCalculator featureBinsCalculator); static String[] cutsArrayToInterval(Number[] splitsArray, boolean leftOpen); }
FeatureBinsUtil { public static Double keepGivenDecimal(Double d, int decimal) { if (null == d) { return null; } BigDecimal bigDecimal = new BigDecimal(d); return bigDecimal.setScale(decimal, BigDecimal.ROUND_HALF_UP).doubleValue(); }  static BinTypes.ColType featureTypeToColType(String featureType, BinDivideType binDivideType); static String getTypeString(TypeInformation<?> type); static TypeInformation<?> getFlinkType(String typeStr); static Double keepGivenDecimal(Double d, int decimal); static Number keepGivenDecimal(Number d, int decimal); static DataSet<FeatureBinsCalculator> parseFeatureBinsModel(DataSet<Row> modelData); static int compareNumbers(Number o1, Number o2); static FeatureBinsCalculator[] deSerialize(String str); static String serialize(FeatureBinsCalculator... featureBinsCalculators); static double calcWoe(long binTotal, long binPositiveTotal, long positiveTotal, long negativeTotal); static long nullIndex(int normBinSize); static long elseIndex(int normBinSize); static int getBinEncodeVectorSize(FeatureBinsCalculator featureBinsCalculator); static String[] cutsArrayToInterval(Number[] splitsArray, boolean leftOpen); static String NULL_LABEL; static String ELSE_LABEL; }