DecimalFormat df = new DecimalFormat("00000");
SimpleDateFormat df = new SimpleDateFormat("yyyy年MM月dd日  HH点mm分ss秒");  用他们对你的数据格式化

解决方案 »

  1.   

    我已经实现了这个功能,非常感谢rong_xing给我的意见。
    我实现的具体程序为
    import java.util.*;
    import java.lang.Object;
    import java.text.SimpleDateFormat;
    public class URShift {
      public static void main(String args[])
    {
        int i = 111;//目标int
        long l = 1200378434;//目标long
        Date currentTime= new Date();
        String stri = pBinInt(i,10);
        String strl = pBinLong(l,5);
        String str3 = pBinDate(currentTime);
        System.out.println(stri);
        System.out.println(strl);
        System.out.println(str3);
      }static String pBinInt(int source,int count)
    {
        String stri =Integer.toString(source);
        int j=Integer.toString(source).length();
        if (j<count)
        {
          for (int i=count;i>=j;i--)
          {
            stri='0'+stri;
          }
        }
        return stri;
      }
      static String pBinLong(long source,int count)
      {
        String stri =Long.toString(source);
        int j=Long.toString(source).length();
        if (j<count)
        {      for (int i=count;i>=j;i--)
          {
            stri='0'+stri;
          }
        }
        return stri;
    }
      static String pBinDate(Date source)
      {
        String stra="";
        SimpleDateFormat simpleDate=new SimpleDateFormat("yyyy年MM月dd日  HH点mm分ss秒");
        stra=simpleDate.format(source);
        return stra;
      }}