mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-24 18:04:54 +08:00
fix bug
This commit is contained in:
parent
95f00b8712
commit
858be6aafa
@ -63,7 +63,7 @@ public class NumberWordFormatter {
|
||||
int index = -1;
|
||||
double res = value;
|
||||
while (res > 10 && (false == isTwo || index < 1)) {
|
||||
if (res > 1000) {
|
||||
if (res >= 1000) {
|
||||
res = res / 1000;
|
||||
index++;
|
||||
}
|
||||
|
@ -31,4 +31,10 @@ public class NumberWordFormatTest {
|
||||
final String format5 = NumberWordFormatter.formatSimple(438);
|
||||
Assert.assertEquals("438", format5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void formatSimpleTest2(){
|
||||
final String s = NumberWordFormatter.formatSimple(1000);
|
||||
Assert.assertEquals("1k", s);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user