public static void longToAscString

/**
  * 把long型转换成明文asc string 不足位用空格填充
  */
 public static void longToAscString(long from, byte[] to, int offset,
   int size, String encode) {
  try {
   byte[] temp = new byte[size];
   byte[] lenStr = (from + "").getBytes(encode);

   for (int i = 0; i < temp.length; i++) {
    temp[i] = " ".getBytes(encode)[0];
   }
   copyData(temp, size - lenStr.length, lenStr, lenStr.length);
   copyData(to, offset, temp, temp.length);
  } catch (Exception e) {
   // e.printStackTrace();
  }
 }

你可能感兴趣的:(exception,String,byte)