SlideShare a Scribd company logo
1 of 2
/*
* 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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
*
* @author x86 a.k.a haripinter
*/
function cetak($string,$pos){
echo $string.$pos;
}
// desimal ke biner
$des = 1000;
$bin = base_convert($des,10,2);
//atau
$bin2 = decbin($des);
cetak($bin." atau ".$bin2,"n");
// desimal ke hexa
$hex = base_convert($des,10,16);
//atau
$hex2 = dechex($des);
cetak($hex." atau ".$hex2,"n");
// biner ke desimal
$des2 = base_convert($bin,2,10);
//atau
$des3 = bindec($bin);
cetak($des2." atau ".$des3,"n");
// hexa ke desimal
$des4 = base_convert($hex,16,10);
//atau
$des5 = hexdec($bin);
cetak($des4." atau ".$des5,"n");
// hexa ke biner
$bin2 = base_convert($hex,16,2);
cetak($bin2,"n");
// biner ke hexa
$hex2 = base_convert($bin,2,16);
cetak($hex2,"n");
?>

More Related Content

What's hot

Prof.js
Prof.jsProf.js
Prof.jsuupaa
 
変態的PHPフレームワーク rhaco
変態的PHPフレームワーク rhaco変態的PHPフレームワーク rhaco
変態的PHPフレームワーク rhacomakoto tsuyuki
 
6.1 Шаблоны классов
6.1 Шаблоны классов6.1 Шаблоны классов
6.1 Шаблоны классовDEVTYPE
 
Effective java 摘選條目分享 2 - 泛型
Effective java   摘選條目分享 2 - 泛型Effective java   摘選條目分享 2 - 泛型
Effective java 摘選條目分享 2 - 泛型Kane Shih
 
Understanding Python decorators
Understanding Python decoratorsUnderstanding Python decorators
Understanding Python decoratorsJosipKatalinic
 
Java осень 2012 лекция 6
Java осень 2012 лекция 6Java осень 2012 лекция 6
Java осень 2012 лекция 6Technopark
 
Go言語勉強会資料
Go言語勉強会資料Go言語勉強会資料
Go言語勉強会資料nametake
 
Matuura concurrent
Matuura concurrentMatuura concurrent
Matuura concurrentmatuura_core
 
数式を構文解析した話
数式を構文解析した話数式を構文解析した話
数式を構文解析した話y1r96 Ueno
 
Func menu mostrar.c
Func menu mostrar.cFunc menu mostrar.c
Func menu mostrar.calbertinous
 

What's hot (20)

JavaScript
JavaScriptJavaScript
JavaScript
 
Librerias de c++
Librerias de c++Librerias de c++
Librerias de c++
 
Php Meets Messagepack
Php Meets MessagepackPhp Meets Messagepack
Php Meets Messagepack
 
Prof.js
Prof.jsProf.js
Prof.js
 
Fila em C
Fila em CFila em C
Fila em C
 
Triangle
TriangleTriangle
Triangle
 
Kasus 3.3 akar
Kasus 3.3 akarKasus 3.3 akar
Kasus 3.3 akar
 
変態的PHPフレームワーク rhaco
変態的PHPフレームワーク rhaco変態的PHPフレームワーク rhaco
変態的PHPフレームワーク rhaco
 
6.1 Шаблоны классов
6.1 Шаблоны классов6.1 Шаблоны классов
6.1 Шаблоны классов
 
Effective java 摘選條目分享 2 - 泛型
Effective java   摘選條目分享 2 - 泛型Effective java   摘選條目分享 2 - 泛型
Effective java 摘選條目分享 2 - 泛型
 
Docuemnto 6
Docuemnto 6Docuemnto 6
Docuemnto 6
 
Menu orastat.c
Menu orastat.cMenu orastat.c
Menu orastat.c
 
Understanding Python decorators
Understanding Python decoratorsUnderstanding Python decorators
Understanding Python decorators
 
Java осень 2012 лекция 6
Java осень 2012 лекция 6Java осень 2012 лекция 6
Java осень 2012 лекция 6
 
Mainfinal
MainfinalMainfinal
Mainfinal
 
Go言語勉強会資料
Go言語勉強会資料Go言語勉強会資料
Go言語勉強会資料
 
ikp213-06-template-c++
ikp213-06-template-c++ikp213-06-template-c++
ikp213-06-template-c++
 
Matuura concurrent
Matuura concurrentMatuura concurrent
Matuura concurrent
 
数式を構文解析した話
数式を構文解析した話数式を構文解析した話
数式を構文解析した話
 
Func menu mostrar.c
Func menu mostrar.cFunc menu mostrar.c
Func menu mostrar.c
 

Viewers also liked

Призентация
ПризентацияПризентация
ПризентацияElena401
 
Разное
РазноеРазное
РазноеBVN MR
 
Siemens digital mammo system
Siemens digital mammo systemSiemens digital mammo system
Siemens digital mammo systemsometltd2013
 
Hacia una escuela para todos y con todos..evidencia paloma.. lectura 1
Hacia una escuela para todos y con todos..evidencia paloma.. lectura 1Hacia una escuela para todos y con todos..evidencia paloma.. lectura 1
Hacia una escuela para todos y con todos..evidencia paloma.. lectura 1PalOma FV
 
PLC Control Panel for HVACR System
PLC Control Panel for HVACR SystemPLC Control Panel for HVACR System
PLC Control Panel for HVACR SystemMuhammad Sarfraz
 

Viewers also liked (12)

RESUME FULL
RESUME FULLRESUME FULL
RESUME FULL
 
Призентация
ПризентацияПризентация
Призентация
 
Sistemas de planeacion 14
Sistemas de planeacion 14Sistemas de planeacion 14
Sistemas de planeacion 14
 
Разное
РазноеРазное
Разное
 
Siemens digital mammo system
Siemens digital mammo systemSiemens digital mammo system
Siemens digital mammo system
 
Ficha de resumen
Ficha de resumenFicha de resumen
Ficha de resumen
 
Atlas Honda Buner
Atlas Honda BunerAtlas Honda Buner
Atlas Honda Buner
 
Planeacion 2bloque contenido 2
Planeacion 2bloque contenido 2Planeacion 2bloque contenido 2
Planeacion 2bloque contenido 2
 
Hacia una escuela para todos y con todos..evidencia paloma.. lectura 1
Hacia una escuela para todos y con todos..evidencia paloma.. lectura 1Hacia una escuela para todos y con todos..evidencia paloma.. lectura 1
Hacia una escuela para todos y con todos..evidencia paloma.. lectura 1
 
PLC Control Panel for HVACR System
PLC Control Panel for HVACR SystemPLC Control Panel for HVACR System
PLC Control Panel for HVACR System
 
Article
ArticleArticle
Article
 
Glass hookah catalogue from Zhan Wang Industiry & Trading Company
Glass hookah catalogue from Zhan Wang Industiry & Trading CompanyGlass hookah catalogue from Zhan Wang Industiry & Trading Company
Glass hookah catalogue from Zhan Wang Industiry & Trading Company
 

Convert bilangan

  • 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
  • 2. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 <?php /** * * @author x86 a.k.a haripinter */ function cetak($string,$pos){ echo $string.$pos; } // desimal ke biner $des = 1000; $bin = base_convert($des,10,2); //atau $bin2 = decbin($des); cetak($bin." atau ".$bin2,"n"); // desimal ke hexa $hex = base_convert($des,10,16); //atau $hex2 = dechex($des); cetak($hex." atau ".$hex2,"n"); // biner ke desimal $des2 = base_convert($bin,2,10); //atau $des3 = bindec($bin); cetak($des2." atau ".$des3,"n"); // hexa ke desimal $des4 = base_convert($hex,16,10); //atau $des5 = hexdec($bin); cetak($des4." atau ".$des5,"n"); // hexa ke biner $bin2 = base_convert($hex,16,2); cetak($bin2,"n"); // biner ke hexa $hex2 = base_convert($bin,2,16); cetak($hex2,"n"); ?>