Decimal 12 into Java version __java

Source: Internet
Author: User
Package zsy.com;

Import java.util.ArrayList;
Import Java.util.Scanner;

public class Jinzhizhuanhuan {public

	static void Main (string[] args) {
		//TODO auto-generated method stub
		Sca Nner in = new Scanner (system.in);
		System.out.print ("Please input the number of your want to change:");
		int a = In.nextint ();
		String B = Get_result (change (a));
		System.out.println (b);
	}
	
	public static arraylist<integer> Change (int n) {
		arraylist<integer> rs = new arraylist<integer> ( );
		int x = 0;
		while (n!=0) {
			x = n%;
			Rs.add (x);
			n = n/12;
		}
		return RS;
	}
	
	public static String Get_result (arraylist<integer> rs) {
		int count = Rs.size ()-1;
		String fin = "";
		for (int i=count;i>=0;i--) {
			if (rs.get (i) ==10) {
				fin = fin + "A";
			} else if (Rs.get (i) ==11) {
				fin = fin + "B";
			} else{
				fin = fin + rs.get (i);
			}
		return fin;
	}

running case and result screenshot:



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.