如何在java中将字节数组转换为BigInteger [英] How to convert byte array to BigInteger in java

查看:1941
本文介绍了如何在java中将字节数组转换为BigInteger的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究java ...我想知道如何将字节数组转换为BigInteger。
实际上我使用了md5的摘要方法,它返回了我想要转换成Biginteger的字节数组。

解决方案


实际上我使用了md5的摘要方法,它返回了我想要转换为 BigInteger 的字节数组。


您可以使用 new BigInteger(byte [])



<但是,应该注意的是MD5哈希在任何有用的意义上都不是真正的整数。它实际上只是一个二进制位模式。



我想你只是这样做,这样你就可以打印或订购MD5哈希。但是,完成这两项任务的内存消耗较少。


I'm working on java... I want to know how to convert array of byte into BigInteger. Actually i used md5's digest method which returned me array of byte which i want to convert into Biginteger.

解决方案

Actually i used md5's digest method which returned me array of byte which i want to convert into a BigInteger.

You can use new BigInteger(byte[]).

However, it should be noted that the MD5 hash is not really an integer in any useful sense. It is really just a binary bit pattern.

I guess you are just doing this so that you can print or order the MD5 hashes. But there are less memory hungry ways of accomplishing both tasks.

这篇关于如何在java中将字节数组转换为BigInteger的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆