convert decimal to binary
public class Solution {
public static void main(String[] args) {
int dNum = ;
String str = "";
while (dNum > ) {
int rem = dNum % ;
str = rem + str;
dNum = dNum / ;
}
System.out.println("Binary value is: " + str);
}
}
OUTPUT:
Binary value is:
convert decimal to binary的更多相关文章
- convert decimal to binary using inbuilt function
package testpacknm; import java.util.Scanner; public class testcnm { public static void main(String[ ...
- Write a program to convert decimal to 32-bit unsigned binary.
Write a program to convert decimal to 32-bit unsigned binary. Write a program to convert a 32-bit un ...
- [Algorithm] Convert a number from decimal to binary
125, how to conver to binary number? function DecimalToDinary (n) { let temp = n; let list = []; if ...
- Convert a given Binary Tree to Doubly Linked List
The question and solution are from: http://www.geeksforgeeks.org/convert-given-binary-tree-doubly-li ...
- Convert string to binary and binary to string in C#
String to binary method: public static string StringToBinary(string data) { StringBuilder sb = new S ...
- [geeksforgeeks] Convert a given Binary Tree to Doubly Linked List
http://www.geeksforgeeks.org/in-place-convert-a-given-binary-tree-to-doubly-linked-list/ Given a Bin ...
- 十进制字符串转成二进制(decimal to binary)
题目:给一个十进制的字符串例如1.25, 将其转化为二进制字符串,这个例子的结果是1.01 = 1*2^0 + 0*2^(-1) + 1*2^(-2) = 1.25. 如果不能完整的用二进制表示,输出 ...
- Data Structure Binary Tree: Convert a given Binary Tree to Doubly Linked List
http://www.geeksforgeeks.org/in-place-convert-a-given-binary-tree-to-doubly-linked-list/ #include &l ...
- Data Structure Binary Tree: Convert an arbitrary Binary Tree to a tree that holds Children Sum Property
http://www.geeksforgeeks.org/convert-an-arbitrary-binary-tree-to-a-tree-that-holds-children-sum-prop ...
随机推荐
- Kubernetes Secret(机密存储)
Kubernetes Secret(机密存储) 官方文档:https://kubernetes.io/docs/concepts/configuration/secret/ 加密数据并存放Etcd中, ...
- War 包部署
Springboot 进行war包部署,以及踩坑历险!!! https://www.jianshu.com/p/4c2f27809571 Springboot2项目配置(热部署+war+外部tomca ...
- mvc ajax跳转controller 的路径
mvc Controller : url: "../phone/index",(控制器名,方法名) 一般处理程序.ashx : url: "../bianji.ashx ...
- MySQL基础(四)(子查询与链接)
1.子查询简介 其中,所谓的“外层查询”并不是指“查找”,指的是所有SQL语句的统称:结构化查询语言(Structured Query Language),简称SQL. : 2.由比较运算符引发的子查 ...
- Git Error:There is no tracking information for the current branch.
在执行git pull的时候,提示当前branch没有跟踪信息: $> git pull There is no tracking information for the current bra ...
- 记录vue用 html5+做移动APP 用barcode做扫一扫功能时安卓 的bug(黑屏、错位等等)和解决方法
最近做项目时,要用到扫一扫二维码的功能,在html5+里面有提供barcode功能,于是照过来用了, 写的代码如下 : 扫码页面: <style lang="less" sc ...
- PHP json中文
json_encode 和 json_decode 只支持utf-8编码的字符串,GBK的字符串要用json就得转换成utf-8字符串 看效果 <?php header("Conten ...
- Spring Cloud Bus介绍--Spring Cloud学习第七天(非原创)
一.什么是Spring Cloud Bus二.Spring Cloud Bus之RabbitMQ介绍三.Spring Cloud Bus整合RabbitMQ四.Spring Cloud Bus整合Ka ...
- 转:Oracle的列转行函数:LISTAGG()
先看示例代码: with temp as( select 'China' nation ,'Guangzhou' city from dual union all select 'China' nat ...
- C# Winform ProgressBar+Labe 联动显示进度
private void btnCount_Click(object sender, EventArgs e) { label1.Visible=true; progressBar.Visible = ...