1. /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mylabs;
/**
*
* @author x86 a.k.a haripinter
*/
public class decimal {
public static void main(String[] haripinter){
int des = 1000;
// desimal ke biner
String bin = Integer.toBinaryString(des);
System.out.println(bin);
// desimal ke hexa
String hex = Integer.toHexString(des);
System.out.println(hex);
// biner ke desimal
int des1 = Integer.valueOf(bin,2);
System.out.println(des1);
// biner ke desimal
int des2 = Integer.valueOf(hex,16);
System.out.println(des2);
// hexa ke biner
String bin2 = Integer.toBinaryString(Integer.valueOf(hex, 16));
System.out.println(bin2);
// biner ke hexa
String hex2 = Integer.toHexString(Integer.valueOf(bin, 2));
System.out.println(hex2);
}
}
Source Code dalam PHP
KOnversi Bilangan dengan PHP
PHP
<?php
/**
*
* @author x86 a.k.a haripinter