MCPcopy Create free account
hub / github.com/MenoData/Time4J / formatYear

Method formatYear

base/src/main/java/net/time4j/PlainDate.java:2098–2126  ·  view source on GitHub ↗
(
        StringBuilder sb,
        int year
    )

Source from the content-addressed store, hash-verified

2096 }
2097
2098 private static void formatYear(
2099 StringBuilder sb,
2100 int year
2101 ) {
2102
2103 int value = year;
2104
2105 if (value < 0) {
2106 sb.append('-');
2107 value = MathUtils.safeNegate(year);
2108 }
2109
2110 if (value >= 10000) {
2111 if (year > 0) {
2112 sb.append('+');
2113 }
2114 } else if (value < 1000) {
2115 sb.append('0');
2116 if (value < 100) {
2117 sb.append('0');
2118 if (value < 10) {
2119 sb.append('0');
2120 }
2121 }
2122 }
2123
2124 sb.append(value);
2125
2126 }
2127
2128 private static void format2Digits(
2129 StringBuilder sb,

Callers 2

toStringMethod · 0.95
fromEpochMonthsMethod · 0.95

Calls 1

safeNegateMethod · 0.95

Tested by

no test coverage detected