手機號碼轉換base64

public static void main(String[] args) {
  TestArray testArray = new TestArray();
   long   i   =   Long.parseLong("13000000000".toString());
  String str =testArray.TestToBase64(i);
  System.out.println("AA" + str);
 }
 
 public String TestToBase64(long lng){
  String base64[] =  {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"};
  String strResult = new String();
  String str = "";
  int i,j;
  i = (int)(lng/64);
  j = (int)(lng%64);
  str = base64[j];
  while(i>0){
   j = i%64;
   i = i/64;
   strResult = base64[j];
   str = strResult + str;
  }
  return str;
 }
發佈了31 篇原創文章 · 獲贊 4 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章