手机号码转换base64

来源:互联网 发布:软件图标大全 编辑:程序博客网 时间:2024/05/02 07:25
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;
 }
原创粉丝点击