MCPcopy Create free account
hub / github.com/Bit0r/java-util / getDecimalLength

Method getDecimalLength

src/main/java/util/CommonUtils.java:527–537  ·  view source on GitHub ↗

获取BigDecimal 有几位小数 @param bigDecimal @return

(BigDecimal bigDecimal)

Source from the content-addressed store, hash-verified

525 * @return
526 */
527 public static Integer getDecimalLength(BigDecimal bigDecimal) {
528 if (bigDecimal == null) {
529 return 0;
530 }
531 String s = bigDecimal.toPlainString();
532 String[] st = s.split("\\.");
533 if (st.length < 2) {
534 return 0;
535 }
536 return st[1].length();
537 }
538
539
540 /**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected