long/int转成string保留5位,前面不足补0

public static void main(String[] args) {
        long a =100L+1999;
        String replace = String.format("%5d", a).replace(" ", "0");
        System.out.println(">>>>>>>>>>>>>>>>>>>>"+replace);
 }

你可能感兴趣的:(long/int转成string保留5位,前面不足补0)