using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace ConsoleAppConvert
{
class Program
{
static void Main(string[] args)
{
for (int i = ; i < ;i++ )
{
String str = Convert.ToString(i).PadLeft(, '');
Console.WriteLine(str);
}
Console.WriteLine("=================================");
byte b = 0xC1;
if ((b>>)!=)
{
Console.WriteLine("{0} 's bit 8 is 1", Convert.ToString(b, ).PadLeft(, ''));
}
else
{
Console.WriteLine("{0} 's bit 8 is 0", Convert.ToString(b, ).PadLeft(, ''));
} b = 0x41;
if ((b >> ) != )
{
Console.WriteLine("{0} 's bit 8 is 1", Convert.ToString(b, ).PadLeft(, ''));
}
else
{
Console.WriteLine("{0} 's bit 8 is 0", Convert.ToString(b, ).PadLeft(, ''));
}
/*
11000001 's bit 8 is 1
01000001 's bit 8 is 0
*/
///////////////////////////////////////
}
}
}
/*
00000001
00000002
00000003
00000004
00000005
00000006
00000007
00000008
00000009
请按任意键继续. . .
*/

Convert PadLeft Bit Operate的更多相关文章

  1. DataTable转换成IList<T>的简单实现

    DataTable的无奈 很多时候,我们需要去操作DataTable.但DataTable的操作,实在是太不方便了.Linq?lambda表达式?统统没有... 特别是对现有结果集做进一步筛选,这样的 ...

  2. How to: Convert Between Various String Types

      This topic demonstrates how to convert various Visual C++ string types into other strings. The str ...

  3. Convert string to binary and binary to string in C#

    String to binary method: public static string StringToBinary(string data) { StringBuilder sb = new S ...

  4. C#中用PadLeft、PadRight 补足位数

    在 C# 中可以对字符串使用 PadLeft 和 PadRight 进行轻松地补位. PadLeft(int totalWidth, char paddingChar) //在字符串左边用 paddi ...

  5. Convert.ToInt32(string '000000003') 变成了 3

    Convert.ToInt32(string '000000003') 变成了 3 但是在查询的时候需要用的是string 这里的convert.toint32 反而起了坏作用,不是所有的时候都要用c ...

  6. Convert BSpline Curve to Arc Spline in OpenCASCADE

    Convert BSpline Curve to Arc Spline in OpenCASCADE eryar@163.com Abstract. The paper based on OpenCA ...

  7. Convert.ToInt32()、int.Parse()和(int)三者的区别

    Convert.ToInt32将object类类型转换成int类型,如Convert.ToInt32(session["shuzi"]); (int)适合简单数据类型之间的转换: ...

  8. Leetcode: Convert sorted list to binary search tree (No. 109)

    Sept. 22, 2015 学一道算法题, 经常回顾一下. 第二次重温, 决定增加一些图片, 帮助自己记忆. 在网上找他人的资料, 不如自己动手. 把从底向上树的算法搞通俗一些. 先做一个例子: 9 ...

  9. [LeetCode] Convert a Number to Hexadecimal 数字转为十六进制

    Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s compl ...

随机推荐

  1. Intellij IDEA运行前不检查其他类的错误

    解决方法 第一步 第二步 在工具栏选择 , Run Configurations  设置在运行前不检查错误 

  2. 最近C#项目中不小心踩的低级坑

    都是很基础的错误问题,大部分都是因为不查一下资料就直接根据其它类似语言的经验写代码导致的 1. 一个企业微信上的正常的界面突然不能滚动了 本以为是浏览器代码计算问题,结果发现是JS出错导致. 2. R ...

  3. 什么是 Shell?

    简单来说“Shell编程就是对一堆Linux命令的逻辑化处理”. Shell 编程的 Hello World 学习任何一门编程语言第一件事就是输出HelloWord了!下面我会从新建文件到shell代 ...

  4. 百度前端技术学院task16源代码

    欢迎访问我的github:huanshen 做这道题目的时候遇到了很多困难. 1.怎么给空对象添加数据,愣是不知道从哪里下手:遍历对象,一个个输出操作: 2.中英文的正则表达式不知道,赶紧去百度: 3 ...

  5. 【简记】修改Docker数据目录位置,包含镜像位置

    为啥要改? Docker安装后默认下载的位置在/var/lib/docker ,如果/var分区没有独立分出来,Linux下默认是与/根分区在一起.一般我们装Linux系统的时候,除了做邮件服务器外, ...

  6. go get 命令

    示例: go get github.com/jinzhu/gorm 下载并安装gorm包. 远程代码库有github,GitLlab,Gogs 命令介绍说明: -fix : 比如,我的代码是一年前1. ...

  7. opencv imshow plt imshow

    opencv官方文档上写的,https://docs.opencv.org/master/dc/d2e/tutorial_py_image_display.html Color image loade ...

  8. SpringBoot中使用@scheduled定时执行任务需要注意的坑

    spring boot: 计划任务@ EnableScheduling和@Scheduled @Scheduled中的参数说明 @Scheduled(fixedRate=2000):上一次开始执行时间 ...

  9. 总结:WPF中MultiBinding多值绑定的方法

    原文:总结:WPF中MultiBinding多值绑定的方法 一.Xaml中绑定代码: <TextBlock  Grid.Row="5" Grid.Column="3 ...

  10. 配置两个不同kerberos认证中心的集群间的互信

    两个Hadoop集群开启Kerberos验证后,集群间不能够相互访问,需要实现Kerberos之间的互信,使用Hadoop集群A的客户端访问Hadoop集群B的服务(实质上是使用Kerberos Re ...