private static String process(ArrayList<String> imp,String HexStr){
String rem = "";
Long remaind = (long) 0;
ArrayList<String> newList = new ArrayList<String>();
Iterator<String> itor = imp.iterator();
while(itor.hasNext()){
String ele = itor.next();
Long num = Long.parseLong(rem+ele);
Long quot = num / 16;
remaind = num%16;
rem = remaind.toString();
if(quot > 0){
newList.add(padString(quot.toString(),16,"0",0));
}
};
String hexRem = Long.toHexString(remaind);
if(newList.isEmpty()){
return hexRem;
} else{
return process(newList,hexRem)+hexRem;
}
}
public static String D2Hex(String dNum){
String tmp = dNum;
ArrayList<String> splitNum = new ArrayList<String>();
while(tmp.length() > 16){
String high = tmp.substring(0,tmp.length() - 16);
splitNum.add(high);
String low = tmp.substring(tmp.length() - 16);
tmp = low;
}
splitNum.add(tmp);
return process(splitNum,"");
}
public static String D2B(String dNum){
String hex = D2Hex(dNum);
StringBuilder bin= new StringBuilder();
for(int i =0; i < hex.length(); i ++){
String tmp = Integer.toBinaryString( Integer.parseInt(hex.substring(i,i+1),16));
bin.append(padString(tmp,4,"0",0));
}
return bin.toString();
}
Hasil nombor super besar tidak disahkan 0------>0--->0000 135,9234------>14bd82--->0001010010111101109,90010111101109,90999,9099 9999 ------>2386f26fc0ffff--->0010001110000110111100100110111111 0000001111111111111111 0,00-t 2386f26fc10 000--->00100011100001101111001001101111111000001000000000000000 9,9999,9999, 9999,9999 ------>16345785d89ffff--->0001011000110100010101111000010111011000100111111110001101000101011110000101110110001001111111111111110000100111111111111111000100111111111111111000100111111111111111999,9999,9999 9,9999,9999,99. 01111100000001111 111111111111111111111111111111
Mengikut prinsip menukar perpuluhan kepada perduaan, simulasi membahagi dengan 2 dan mengambil baki
Sepatutnya tidak terlalu sukar untuk menulis algoritma sendiri, dan biarkan ia di latar belakang untuk diproses
Hasil nombor super besar tidak disahkan
0------>0--->0000
135,9234------>14bd82--->0001010010111101109,90010111101109,90999,9099 9999 ------>2386f26fc0ffff--->0010001110000110111100100110111111 0000001111111111111111
0,00-t 2386f26fc10 000--->00100011100001101111001001101111111000001000000000000000
9,9999,9999, 9999,9999 ------>16345785d89ffff--->0001011000110100010101111000010111011000100111111110001101000101011110000101110110001001111111111111110000100111111111111111000100111111111111111000100111111111111111999,9999,9999 9,9999,9999,99. 01111100000001111 111111111111111111111111111111
Tulis apa sahaja yang anda mahukan
Saya nak tanya, super besar, berapa besarnya
Jika ia hanya untuk paparan, anda boleh mempertimbangkan untuk membiarkannya dipindahkan di latar belakang