0 Replies - 3440 Views - Last Post: 16 February 2009 - 08:17 PM Rate Topic: -----

#1 amf!   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-February 09

number base conversion

Post icon  Posted 16 February 2009 - 08:17 PM

 

package dota;

public class noob extends javax.swing.JFrame {

	/** Creates new form noob */
	public noob() {
		initComponents();
	}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {										 
		char noob;
		int i, k;
		double chi= 0;
		int bum[][];
		bum = new int[100][111];
		int base= Integer.parseInt(jTextField1.getText());
		String num = jTextField2.getText();
		for(i=num.length()-1;i>=0;i--){
			noob = num.charAt(i);
			chi += Character.digit(noob,base) * Math.pow(base, i);
		}
		jTextField11.setText(String.valueOf((int)chi));
		for(int l=2;l<35;l++){
			k = (int) chi;
			for(int j=1;k!=0;j++){
				bum[l][j]=(int) (k % l);
				k = (int) (k / l);
			}
		}
		jTextField3.setText(String.valueOf(bum[2]));
		jTextField4.setText(String.valueOf(bum[3]));
		jTextField5.setText(String.valueOf(bum[4]));
	}							

 public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new noob().setVisible(true);
			}
		});
	}




Good morning! may you please check my code in converting base number from base 2 to 36.. The code that Ived shown to you is just the conversion of base 10..Above is only the beginning of my code..may you please teach me of an algorithm that converts number base from base 2 to 36 because it finds me difficult to make program converting numbers from base 2 to 36..thanks a lot..I'll wait for your response as soon as possible...

Is This A Good Question/Topic? 0
  • +

Page 1 of 1