import java.util.Scanner;publicclassOj{publicstaticinttoDec(int num){// 十进制四位数字之和int a = num /1000;int b = num /100%10;int c = num /10%10;int d = num %10;int result = a + b + c + d;return result;}publicstaticinttoHex(int num){// 十六进制四位数字之和int result =0;while(num !=0){int x = num &0xF;
result += x;
num =(num >>>4);}return result;}publicstaticinttoDuo(int num){// 十二进制四位数字之和int result =0;int x =0;// 定义一个int变量接受while(num !=0){// 除十二取余法
x = num %12;
num = num /12;
result += x;}return result;}publicstaticvoidmain(String[] args){int n =0;
Scanner scan =newScanner(System.in);if(scan.hasNextInt()){
n = scan.nextInt();}
scan.close();if(toHex(n)==toDec(n)&&toDec(n)==toDuo(n)){
System.out.println(n +" is a Sky Number.");}else
System.out.println(n +" is not a Sky Number.");}}
进制转换oj题java实现import java.util.Scanner;public class Oj { public static int toDec(int num) {// 十进制四位数字之和 int a = num / 1000; int b = num / 100 % 10; int c = num / 10 % 10; int d = num % 10; int result = a + b + c + d; return result; } pu