大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺
/** 数字转大写字母(26进制)1->A 2->B
* @since JDK 1.8
*/
public static String numCovertLetter(int num) {
if (num <= 0) {
throw new RuntimeException("参数必须大于0");
}
String str = "";
while (num > 0) {
int residue = num % 26;
if (residue == 0) {
residue = 26;
}
str = String.valueOf((char) (residue + '@')) + str;
num = (num - residue) / 26;
}
return str;
}
/** 大写字母转数字(26进制->10进制)A->1 B->2
* @since JDK 1.8
*/
public static Integer letterCovertnum(String letter) {
if (letter == null || letter.isEmpty()) {
return 0;
}
Integer result = 0;
char[] charArray = letter.toCharArray();
int count = 0;
for (int i = letter.length() - 1; i >= 0; i--, count++) {
char c = charArray[i];
double pow = (c - '@') * Math.pow(26, count);
result += (int) pow;
}
return result;
}
public static void main(String[] args) throws Exception {
System.out.println(letterCovertnum("ALK"));
for (int i = 1; i < 1000; i++) {
System.out.print(numCovertLetter(i));
// System.out.print(" ");
System.out.print("_" + i + " ");
if (i % 26 == 0) {
System.out.println("");
}
}
}
控制台输出结果
999
A_1 B_2 C_3 D_4 E_5 F_6 G_7 H_8 I_9 J_10 K_11 L_12 M_13 N_14 O_15 P_16 Q_17 R_18 S_19 T_20 U_21 V_22 W_23 X_24 Y_25 Z_26
AA_27 AB_28 AC_29 AD_30 AE_31 AF_32 AG_33 AH_34 AI_35 AJ_36 AK_37 AL_38 AM_39 AN_40 AO_41 AP_42 AQ_43 AR_44 AS_45 AT_46 AU_47 AV_48 AW_49 AX_50 AY_51 AZ_52
BA_53 BB_54 BC_55 BD_56 BE_57 BF_58 BG_59 BH_60 BI_61 BJ_62 BK_63 BL_64 BM_65 BN_66 BO_67 BP_68 BQ_69 BR_70 BS_71 BT_72 BU_73 BV_74 BW_75 BX_76 BY_77 BZ_78
CA_79 CB_80 CC_81 CD_82 CE_83 CF_84 CG_85 CH_86 CI_87 CJ_88 CK_89 CL_90 CM_91 CN_92 CO_93 CP_94 CQ_95 CR_96 CS_97 CT_98 CU_99 CV_100 CW_101 CX_102 CY_103 CZ_104
DA_105 DB_106 DC_107 DD_108 DE_109 DF_110 DG_111 DH_112 DI_113 DJ_114 DK_115 DL_116 DM_117 DN_118 DO_119 DP_120 DQ_121 DR_122 DS_123 DT_124 DU_125 DV_126 DW_127 DX_128 DY_129 DZ_130
EA_131 EB_132 EC_133 ED_134 EE_135 EF_136 EG_137 EH_138 EI_139 EJ_140 EK_141 EL_142 EM_143 EN_144 EO_145 EP_146 EQ_147 ER_148 ES_149 ET_150 EU_151 EV_152 EW_153 EX_154 EY_155 EZ_156
FA_157 FB_158 FC_159 FD_160 FE_161 FF_162 FG_163 FH_164 FI_165 FJ_166 FK_167 FL_168 FM_169 FN_170 FO_171 FP_172 FQ_173 FR_174 FS_175 FT_176 FU_177 FV_178 FW_179 FX_180 FY_181 FZ_182
GA_183 GB_184 GC_185 GD_186 GE_187 GF_188 GG_189 GH_190 GI_191 GJ_192 GK_193 GL_194 GM_195 GN_196 GO_197 GP_198 GQ_199 GR_200 GS_201 GT_202 GU_203 GV_204 GW_205 GX_206 GY_207 GZ_208
HA_209 HB_210 HC_211 HD_212 HE_213 HF_214 HG_215 HH_216 HI_217 HJ_218 HK_219 HL_220 HM_221 HN_222 HO_223 HP_224 HQ_225 HR_226 HS_227 HT_228 HU_229 HV_230 HW_231 HX_232 HY_233 HZ_234
IA_235 IB_236 IC_237 ID_238 IE_239 IF_240 IG_241 IH_242 II_243 IJ_244 IK_245 IL_246 IM_247 IN_248 IO_249 IP_250 IQ_251 IR_252 IS_253 IT_254 IU_255 IV_256 IW_257 IX_258 IY_259 IZ_260
JA_261 JB_262 JC_263 JD_264 JE_265 JF_266 JG_267 JH_268 JI_269 JJ_270 JK_271 JL_272 JM_273 JN_274 JO_275 JP_276 JQ_277 JR_278 JS_279 JT_280 JU_281 JV_282 JW_283 JX_284 JY_285 JZ_286
KA_287 KB_288 KC_289 KD_290 KE_291 KF_292 KG_293 KH_294 KI_295 KJ_296 KK_297 KL_298 KM_299 KN_300 KO_301 KP_302 KQ_303 KR_304 KS_305 KT_306 KU_307 KV_308 KW_309 KX_310 KY_311 KZ_312
LA_313 LB_314 LC_315 LD_316 LE_317 LF_318 LG_319 LH_320 LI_321 LJ_322 LK_323 LL_324 LM_325 LN_326 LO_327 LP_328 LQ_329 LR_330 LS_331 LT_332 LU_333 LV_334 LW_335 LX_336 LY_337 LZ_338
MA_339 MB_340 MC_341 MD_342 ME_343 MF_344 MG_345 MH_346 MI_347 MJ_348 MK_349 ML_350 MM_351 MN_352 MO_353 MP_354 MQ_355 MR_356 MS_357 MT_358 MU_359 MV_360 MW_361 MX_362 MY_363 MZ_364
NA_365 NB_366 NC_367 ND_368 NE_369 NF_370 NG_371 NH_372 NI_373 NJ_374 NK_375 NL_376 NM_377 NN_378 NO_379 NP_380 NQ_381 NR_382 NS_383 NT_384 NU_385 NV_386 NW_387 NX_388 NY_389 NZ_390
OA_391 OB_392 OC_393 OD_394 OE_395 OF_396 OG_397 OH_398 OI_399 OJ_400 OK_401 OL_402 OM_403 ON_404 OO_405 OP_406 OQ_407 OR_408 OS_409 OT_410 OU_411 OV_412 OW_413 OX_414 OY_415 OZ_416
PA_417 PB_418 PC_419 PD_420 PE_421 PF_422 PG_423 PH_424 PI_425 PJ_426 PK_427 PL_428 PM_429 PN_430 PO_431 PP_432 PQ_433 PR_434 PS_435 PT_436 PU_437 PV_438 PW_439 PX_440 PY_441 PZ_442
QA_443 QB_444 QC_445 QD_446 QE_447 QF_448 QG_449 QH_450 QI_451 QJ_452 QK_453 QL_454 QM_455 QN_456 QO_457 QP_458 QQ_459 QR_460 QS_461 QT_462 QU_463 QV_464 QW_465 QX_466 QY_467 QZ_468
RA_469 RB_470 RC_471 RD_472 RE_473 RF_474 RG_475 RH_476 RI_477 RJ_478 RK_479 RL_480 RM_481 RN_482 RO_483 RP_484 RQ_485 RR_486 RS_487 RT_488 RU_489 RV_490 RW_491 RX_492 RY_493 RZ_494
SA_495 SB_496 SC_497 SD_498 SE_499 SF_500 SG_501 SH_502 SI_503 SJ_504 SK_505 SL_506 SM_507 SN_508 SO_509 SP_510 SQ_511 SR_512 SS_513 ST_514 SU_515 SV_516 SW_517 SX_518 SY_519 SZ_520
TA_521 TB_522 TC_523 TD_524 TE_525 TF_526 TG_527 TH_528 TI_529 TJ_530 TK_531 TL_532 TM_533 TN_534 TO_535 TP_536 TQ_537 TR_538 TS_539 TT_540 TU_541 TV_542 TW_543 TX_544 TY_545 TZ_546
UA_547 UB_548 UC_549 UD_550 UE_551 UF_552 UG_553 UH_554 UI_555 UJ_556 UK_557 UL_558 UM_559 UN_560 UO_561 UP_562 UQ_563 UR_564 US_565 UT_566 UU_567 UV_568 UW_569 UX_570 UY_571 UZ_572
VA_573 VB_574 VC_575 VD_576 VE_577 VF_578 VG_579 VH_580 VI_581 VJ_582 VK_583 VL_584 VM_585 VN_586 VO_587 VP_588 VQ_589 VR_590 VS_591 VT_592 VU_593 VV_594 VW_595 VX_596 VY_597 VZ_598
WA_599 WB_600 WC_601 WD_602 WE_603 WF_604 WG_605 WH_606 WI_607 WJ_608 WK_609 WL_610 WM_611 WN_612 WO_613 WP_614 WQ_615 WR_616 WS_617 WT_618 WU_619 WV_620 WW_621 WX_622 WY_623 WZ_624
XA_625 XB_626 XC_627 XD_628 XE_629 XF_630 XG_631 XH_632 XI_633 XJ_634 XK_635 XL_636 XM_637 XN_638 XO_639 XP_640 XQ_641 XR_642 XS_643 XT_644 XU_645 XV_646 XW_647 XX_648 XY_649 XZ_650
YA_651 YB_652 YC_653 YD_654 YE_655 YF_656 YG_657 YH_658 YI_659 YJ_660 YK_661 YL_662 YM_663 YN_664 YO_665 YP_666 YQ_667 YR_668 YS_669 YT_670 YU_671 YV_672 YW_673 YX_674 YY_675 YZ_676
ZA_677 ZB_678 ZC_679 ZD_680 ZE_681 ZF_682 ZG_683 ZH_684 ZI_685 ZJ_686 ZK_687 ZL_688 ZM_689 ZN_690 ZO_691 ZP_692 ZQ_693 ZR_694 ZS_695 ZT_696 ZU_697 ZV_698 ZW_699 ZX_700 ZY_701 ZZ_702
AAA_703 AAB_704 AAC_705 AAD_706 AAE_707 AAF_708 AAG_709 AAH_710 AAI_711 AAJ_712 AAK_713 AAL_714 AAM_715 AAN_716 AAO_717 AAP_718 AAQ_719 AAR_720 AAS_721 AAT_722 AAU_723 AAV_724 AAW_725 AAX_726 AAY_727 AAZ_728
ABA_729 ABB_730 ABC_731 ABD_732 ABE_733 ABF_734 ABG_735 ABH_736 ABI_737 ABJ_738 ABK_739 ABL_740 ABM_741 ABN_742 ABO_743 ABP_744 ABQ_745 ABR_746 ABS_747 ABT_748 ABU_749 ABV_750 ABW_751 ABX_752 ABY_753 ABZ_754
ACA_755 ACB_756 ACC_757 ACD_758 ACE_759 ACF_760 ACG_761 ACH_762 ACI_763 ACJ_764 ACK_765 ACL_766 ACM_767 ACN_768 ACO_769 ACP_770 ACQ_771 ACR_772 ACS_773 ACT_774 ACU_775 ACV_776 ACW_777 ACX_778 ACY_779 ACZ_780
ADA_781 ADB_782 ADC_783 ADD_784 ADE_785 ADF_786 ADG_787 ADH_788 ADI_789 ADJ_790 ADK_791 ADL_792 ADM_793 ADN_794 ADO_795 ADP_796 ADQ_797 ADR_798 ADS_799 ADT_800 ADU_801 ADV_802 ADW_803 ADX_804 ADY_805 ADZ_806
AEA_807 AEB_808 AEC_809 AED_810 AEE_811 AEF_812 AEG_813 AEH_814 AEI_815 AEJ_816 AEK_817 AEL_818 AEM_819 AEN_820 AEO_821 AEP_822 AEQ_823 AER_824 AES_825 AET_826 AEU_827 AEV_828 AEW_829 AEX_830 AEY_831 AEZ_832
AFA_833 AFB_834 AFC_835 AFD_836 AFE_837 AFF_838 AFG_839 AFH_840 AFI_841 AFJ_842 AFK_843 AFL_844 AFM_845 AFN_846 AFO_847 AFP_848 AFQ_849 AFR_850 AFS_851 AFT_852 AFU_853 AFV_854 AFW_855 AFX_856 AFY_857 AFZ_858
AGA_859 AGB_860 AGC_861 AGD_862 AGE_863 AGF_864 AGG_865 AGH_866 AGI_867 AGJ_868 AGK_869 AGL_870 AGM_871 AGN_872 AGO_873 AGP_874 AGQ_875 AGR_876 AGS_877 AGT_878 AGU_879 AGV_880 AGW_881 AGX_882 AGY_883 AGZ_884
AHA_885 AHB_886 AHC_887 AHD_888 AHE_889 AHF_890 AHG_891 AHH_892 AHI_893 AHJ_894 AHK_895 AHL_896 AHM_897 AHN_898 AHO_899 AHP_900 AHQ_901 AHR_902 AHS_903 AHT_904 AHU_905 AHV_906 AHW_907 AHX_908 AHY_909 AHZ_910
AIA_911 AIB_912 AIC_913 AID_914 AIE_915 AIF_916 AIG_917 AIH_918 AII_919 AIJ_920 AIK_921 AIL_922 AIM_923 AIN_924 AIO_925 AIP_926 AIQ_927 AIR_928 AIS_929 AIT_930 AIU_931 AIV_932 AIW_933 AIX_934 AIY_935 AIZ_936
AJA_937 AJB_938 AJC_939 AJD_940 AJE_941 AJF_942 AJG_943 AJH_944 AJI_945 AJJ_946 AJK_947 AJL_948 AJM_949 AJN_950 AJO_951 AJP_952 AJQ_953 AJR_954 AJS_955 AJT_956 AJU_957 AJV_958 AJW_959 AJX_960 AJY_961 AJZ_962
AKA_963 AKB_964 AKC_965 AKD_966 AKE_967 AKF_968 AKG_969 AKH_970 AKI_971 AKJ_972 AKK_973 AKL_974 AKM_975 AKN_976 AKO_977 AKP_978 AKQ_979 AKR_980 AKS_981 AKT_982 AKU_983 AKV_984 AKW_985 AKX_986 AKY_987 AKZ_988
ALA_989 ALB_990 ALC_991 ALD_992 ALE_993 ALF_994 ALG_995 ALH_996 ALI_997 ALJ_998 ALK_999
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/193290.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...