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. python 强制结束线程的坑

    网上流传了两种能强制结束线程的错误姿势 第一种:通过setDaemon来结束线程 http://www.cnblogs.com/jefferybest/archive/2011/10/09/22040 ...

  2. 用setTimeout实现与setInteval类似的功能

    用setTimeout实现与setInteval类似的功能,代码如下: (function(){ var self = arguments.callee; //获取函数本身 count++; if ( ...

  3. [妙味JS基础]第九课:定时器管理、函数封装

    知识点总结 函数封装 回调函数 实例:抖动函数 获取当前的位置 通过数组来实现,一正一负,直到恢复成0为止. 当前位置与数组中各值相加

  4. HDU 4247 A Famous ICPC Team

    Problem Description Mr. B, Mr. G, Mr. M and their coach Professor S are planning their way to Warsaw ...

  5. 【Python@Thread】锁示例

    当出现竞态条件时候,即在同一个时刻只有一个线程可以进入临界区,需要使用同步. 常见的同步原语有两种:锁/互斥,信号量. 锁是最简单,最低级的机制. 首先看一个不使用锁时候的多线程示例: from at ...

  6. git上传代码到github

    git上传代码到github [root@bigdata-hadoop- ~]# git init [root@bigdata-hadoop- ~]# git add zeppelin [root@b ...

  7. MySQL 的一个Bug?

    在 my.ini 中的 [mysqld] 段设置 mysql basedir 和 datadir,如下: #Path to installation directory. All paths are ...

  8. C# 将List中的数据导入csv文件中

    //http://www.cnblogs.com/mingmingruyuedlut/archive/2013/01/20/2849906.html C# 将List中的数据导入csv文件中   将数 ...

  9. IE8“开发人员工具”使用详解上(各级菜单详解)

    来源: http://www.cnblogs.com/JustinYoung/archive/2009/03/24/kaifarenyuangongju.html IE8“开发人员工具”使用详解上(各 ...

  10. Saltstack 操作目标,正则匹配,及组管理

    如果我们要维护好一个庞大的配置管理系统那么首选得维护好我们的管理对象,在saltstack系统中我们的管理对象叫做Target, 在master上我们可以采用不同Target去管理不同的Minion. ...