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 ...
随机推荐
- Spring源码系列 — 容器Extend Point(一)
前言 前文介绍了Spring中的BeanDefinition的细节,随着Spring的启动流程,这节我们介绍Spring的后续处理过程 - Spring的扩展点: BeanFactoryPostPro ...
- jdbc:mysql:/// jdbc连接数据url简写方式
正常情况下我们写jdbc连接本地mysql数据库的时候通常是这样写 jdbc:mysql:localhost:3306/数据库名 下面就是要提到的简单的方法 jdbc:mysql:///数据库名
- .Net常见的IOC框架及AOP框架
IOC框架 Unity:微软patterns&practicest团队开发的IOC依赖注入框架,支持AOP横切关注点. MEF(Managed Extensibility Framework) ...
- Flask笔记:session
session与cookie: cookie是一项浏览器的技术,而不是服务器的技术,服务器端是无法直接操作cookie的,只能通过返回Response响应告诉浏览器怎么操作cookie.而sessio ...
- Python基础23(习惯)
自己写的大段代码,注释分为两种: 一种 # 顶格写,为后注释," Ctrl+/ " 一种为边写边注释
- Vim操作:打开文件
1.打开文件并定位到某一行 vim +20 vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php # 定位至第20行 2 ...
- python基础-面向对象编程之反射
面向对象编程之反射 反射 定义:通过字符串对对象的属性和方法进行操作. 反射有4个方法,都是python内置的,分别是: hasattr(obj,name:str) 通过"字符串" ...
- Linux强制关掉其他ssh登录的用户
Linux强制关掉其他ssh登录的用户 首先 用who命令查看登录的iproot pts/0 162.16.16.155 14:30 0.00s 0.07s 0.05s wroot pts/1 162 ...
- js 实现JSONP
编写一个 jsonp.html 内容如下: <!DOCTYPE html> <html lang="en"> <head> <meta c ...
- apache主配置文件设置
主配置文件:httpd.conf #设置管理员邮箱地址ServerAdmin admin@example.com#定义apache安装根目录变量Define SRVROOT "F:\www\ ...