try {

	File file = new File(Environment.getExternalStorageDirectory(),"shuju2");
if(!file.exists()){
file.createNewFile();
}
FileWriter fw = new FileWriter(file);
BufferedWriter out = new BufferedWriter(fw);
out.write(toHexString1(bytes));
out.close();
} catch (IOException e) {
e.printStackTrace();
} public static String toHexString1(byte[] b){
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < b.length; ++i){
buffer.append(toHexString1(b[i]));
}
return buffer.toString();
} public static String toHexString1(byte b){
String s = Integer.toHexString(b & 0xFF);
if (s.length() == 1){
return "0" + s;
}else{
return s;
}
}

  

byte数组转16进制 输出到文件的更多相关文章

  1. java byte数组与16进制间的相互转换

      java byte数组与16进制间的相互转换 CreationTime--2018年6月11日15点34分 Author:Marydon 1.准备工作 import java.util.Array ...

  2. C# byte数组与16进制间的相互转换

      1.byte数组转16进制字符串 /// <summary> /// 将一个byte数组转换成16进制字符串 /// </summary> /// <param na ...

  3. BYTE数组与16进制字符串互转

    //字节数组转换为HEX 字符串const string Byte2HexString(const unsigned char* input, const int datasize) { ]; ; j ...

  4. 加密算法使用(二):使用MD5加密字符串(另:byte数组转16进制自动补零方法写法)

    public static void main(String args[]) throws NoSuchAlgorithmException { String s = new String(" ...

  5. java字节数组和16进制之间的转换

    /* * To change this template, choose Tools | Templates * and open the template in the editor. */ pac ...

  6. Java中byte与(16进制)字符串的互相转换

    java中byte用二进制表示占用8位,而我们知道16进制的每个字符需要用4位二进制位来表示,所以我们就可以把每个byte转换成两个相应的16进制字符,即把byte的高4位和低4位分别转换成相应的16 ...

  7. java中把字节数组转换为16进制字符串

    把字符串数组转换为16进制字符串 import java.security.MessageDigest; public class StringUtil { public StringUtil() { ...

  8. C#//字节数组转16进制字符串

    //字节数组转16进制字符串 private static string byteToHexStr(byte[] bytes,int length) { string returnStr = &quo ...

  9. 基于visual Studio2013解决面试题之1203转16进制输出

     题目

随机推荐

  1. HDU 2601 An easy problem

    (i+1)*(j+1)=n+1 转换成上面这个式子,也就是问n+1的因子有几个 #include<cstdio> #include<cstring> #include<c ...

  2. Node.js:包

    概要:本篇博客主要介绍了node.js中的包 包是在模块基础上更深一步的抽象,Node.js的包类似于C/C++的库函数或者Java/.Net的类库.它将某个独立的功能封装起来,用于发布.更新.依赖管 ...

  3. 火狐中,设置align="center"失效的解决方法

    如下: <img align="center" style="vertical-align:top"></img> 只需要加上: ver ...

  4. boost 编译依赖库

    正则表达式 icu-devel python python-devel bzip2-devel ./b2 variant=release link=shared threading=multi run ...

  5. MySQL Logs

    摘要 一.MySQL日志 1.1 查询日志 1.2 慢查询日志 1.3 错误日志 1.4 二进制日志 一. MySQL日志 MySQL服务器上一共有六种日志:错误日志,查询日志,慢查询日志,二进制日志 ...

  6. 图片拉伸:resizableImageWithCapInsets

    iOS 5.0 在iOS 5.0中,UIImage有一个新方法可以处理图片的拉伸问题 - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)ca ...

  7. 【Python爬虫实战--2】时间戳转换为指定格式日期

    摘自:http://www.2cto.com/kf/201406/311477.html (1)方法: 方法一: 利用localtime()转换为时间数组,然后格式化为需要的格式,如 timeStam ...

  8. 消除警告"property access result unused - getters should not be used for side effects"

    我写了如下一段代码: - (void)btnClicked:(UIButton *)button { switch (button.tag) { : self.initShare; break; de ...

  9. mysql、sqlserver数据库常见数据类型对应java中的的类型探究

    由于本次测试表的结构不涉及到主键的自增长,所以mysql.sqlserver建表语句相同: CREATE TABLE testType ( id INT NOT NULL DEFAULT 0, gen ...

  10. linux内核驱动——从helloworld开始

    学习编程第一个都是学习hello world程序,学习内核驱动自然也不例外,我也是!本文整理了网上的一些资料以及加上自己的一些心得体会,希望对初学者有帮助,可别小看这个简单的hello world,本 ...