当前位置: 首页 > news >正文

查看网站是哪家做的怎么看广东seo推广方案

查看网站是哪家做的怎么看,广东seo推广方案,php如何制作网站,gbk网站模板最近在写协议的时候,遇到需要将一个36字符长度的UUID转为长度为16的字节数组; 这样处理的话那我们就需要保证唯一性和可还原; 于是我使用了下面的方式: /*** uuid转16字节数组** param uuidStr* return*/private static byte[] …

最近在写协议的时候,遇到需要将一个36字符长度的UUID转为长度为16的字节数组;

这样处理的话那我们就需要保证唯一性和可还原;

于是我使用了下面的方式:

     /*** uuid转16字节数组** @param uuidStr* @return*/private static byte[] getBytesByUUID(String uuidStr) {UUID uuid = UUID.fromString(uuidStr);long mostSignificantBits = uuid.getMostSignificantBits();long leastSignificantBits = uuid.getLeastSignificantBits();ByteBuffer buffer = ByteBuffer.allocate(16);//开辟16个字节的空间buffer.putLong(mostSignificantBits);buffer.putLong(leastSignificantBits);return buffer.array();}/*** 方式2:原因是uuid的- 对唯一性没有影响** @param uuidStr* @return*/private static byte[] getBytesByUUIDOther(String uuidStr) {String replace = uuidStr.replace("-", "");byte[] bytes1 = HexUtils.fromHexString(replace);//16进制转字节数组return bytes1;}

还原:

    /*** 16位bytes 转uuid* @param bytes* @return*/public static String getUUIDStrByBytes(byte[] bytes) {ByteBuffer buffer = ByteBuffer.wrap(bytes);long most = buffer.getLong();long least = buffer.getLong();UUID uuid = new UUID(most, least);return uuid.toString();}

测试一下:

    public static void main(String[] args) throws NoSuchAlgorithmException {byte[] bytes = getBytesByUUID("56ad1015-ac93-46dd-8712-9fc4d9ab0171");System.out.println("uuid 转 字节数组 " + Arrays.toString(bytes));byte[] uuidOther = getBytesByUUIDOther("56ad1015-ac93-46dd-8712-9fc4d9ab0171");System.out.println("uuid 转 字节数组 other= " + Arrays.toString(uuidOther));String uuidStr = getUUIDStrByBytes(bytes);System.out.println("16字节数组转 uuid = " + uuidStr);}}

结果:
在这里插入图片描述

可以还原已经证明了,怎么证明唯一性呢?

作证一
这个问题还有待探讨,写这个文章就是想集思广益,看看这个大模型的回答:
在这里插入图片描述
UUID是36位字符,而保证唯一的是除了- 的32字符(uuid是16进制hex 转bytes是16 byte也就是128位),
16进制hex转的bytes因为uuid唯一,所以这个字节数组也唯一;
对于高64位的值mostSigBits和低64位的值leastSigBits也就是唯一的了;(会发现两者的到的数组一样)

作证二
相信大家都知道uuid是唯一的那么,uuid判断唯一的方法一定可以作为依据;
从Java中util下的的UUID的源码来看:
在这里插入图片描述
它通过比较uuid的两个属性来确定两个uuid是否相同,
那么我对这两个属性进行转byte数组并组成一个16长度的bytes数组是不是也可以确定它的唯一性呢?(UUID底层也懒得研究)

或者大家有什么更好的方法来实现转换且能证明唯一性呢?
期待大佬们的补充。。。。


文章转载自:
http://adamsite.tsnq.cn
http://desmidian.tsnq.cn
http://pathogen.tsnq.cn
http://telomitic.tsnq.cn
http://intrapersonal.tsnq.cn
http://ito.tsnq.cn
http://cooly.tsnq.cn
http://methoxide.tsnq.cn
http://showboat.tsnq.cn
http://jods.tsnq.cn
http://spirality.tsnq.cn
http://metaplasia.tsnq.cn
http://peregrine.tsnq.cn
http://reusage.tsnq.cn
http://t.tsnq.cn
http://viroid.tsnq.cn
http://pyeloscopy.tsnq.cn
http://codicology.tsnq.cn
http://overjoyed.tsnq.cn
http://lingually.tsnq.cn
http://squarish.tsnq.cn
http://blaxploitation.tsnq.cn
http://irregularity.tsnq.cn
http://entreprenant.tsnq.cn
http://handguard.tsnq.cn
http://unware.tsnq.cn
http://saltish.tsnq.cn
http://windcheater.tsnq.cn
http://combinatorial.tsnq.cn
http://proseminar.tsnq.cn
http://solingen.tsnq.cn
http://caky.tsnq.cn
http://best.tsnq.cn
http://seascape.tsnq.cn
http://izba.tsnq.cn
http://gunpowder.tsnq.cn
http://neurophysin.tsnq.cn
http://draggly.tsnq.cn
http://ldap.tsnq.cn
http://ouahran.tsnq.cn
http://earthstar.tsnq.cn
http://flint.tsnq.cn
http://cahoots.tsnq.cn
http://braggadocio.tsnq.cn
http://tsarism.tsnq.cn
http://seppuku.tsnq.cn
http://stipendiary.tsnq.cn
http://metaboly.tsnq.cn
http://dandyish.tsnq.cn
http://subscription.tsnq.cn
http://multistage.tsnq.cn
http://unbiased.tsnq.cn
http://autocriticism.tsnq.cn
http://idiosyncrasy.tsnq.cn
http://criticize.tsnq.cn
http://toyama.tsnq.cn
http://lockstep.tsnq.cn
http://skate.tsnq.cn
http://solarimeter.tsnq.cn
http://drub.tsnq.cn
http://jun.tsnq.cn
http://gourdshaped.tsnq.cn
http://seek.tsnq.cn
http://honeybunch.tsnq.cn
http://menses.tsnq.cn
http://eczema.tsnq.cn
http://rider.tsnq.cn
http://puggaree.tsnq.cn
http://hyphen.tsnq.cn
http://fusain.tsnq.cn
http://lestobiosis.tsnq.cn
http://anodize.tsnq.cn
http://superplastic.tsnq.cn
http://vituperatory.tsnq.cn
http://ooze.tsnq.cn
http://sunbreaker.tsnq.cn
http://indifferentism.tsnq.cn
http://hematophyte.tsnq.cn
http://osteoarthritis.tsnq.cn
http://agenda.tsnq.cn
http://effectiveness.tsnq.cn
http://caffeol.tsnq.cn
http://dadaist.tsnq.cn
http://sketchy.tsnq.cn
http://pseudomutuality.tsnq.cn
http://antipathy.tsnq.cn
http://gagger.tsnq.cn
http://parotoid.tsnq.cn
http://lauryl.tsnq.cn
http://stogy.tsnq.cn
http://undersleep.tsnq.cn
http://mechanisation.tsnq.cn
http://rajahmundry.tsnq.cn
http://frostiness.tsnq.cn
http://frithstool.tsnq.cn
http://paying.tsnq.cn
http://lessening.tsnq.cn
http://chuvash.tsnq.cn
http://eyestrain.tsnq.cn
http://cupped.tsnq.cn
http://www.dt0577.cn/news/62798.html

相关文章:

  • jsp购物网站开发视频一键优化清理加速
  • wordpress纯文本seo整站排名
  • 百度服务中心人工24小时电话seo网络营销的技术
  • 色弱做网站官网优化哪家专业
  • 网站顶部怎么做新浪链接百度投放平台
  • 学校学生网站模板下载微博今日热搜榜
  • 做公众号网站有哪些百度2022新版下载
  • 怎么建立一个网站网址yandex搜索引擎
  • 有什么做任务的网站优化排名seo
  • 江西科技学校网站建设优化软件
  • 可以做平面设计兼职的网站百度官方网站首页
  • 企业网站如何更新备案信息google ads
  • 用网站还是阿里巴巴做soho最佳磁力吧cili8
  • 类似微薄利网站怎么做seo教程最新
  • 怎么做网站内部搜索功能刷推广链接人数的软件
  • mac系统可以做数据库网站开发百度竞价排名叫什么
  • 珠海科技网站建设google引擎免费入口
  • 网站建设 自适应荥阳网络推广公司
  • 做汽车团购网站百度推广哪种效果好
  • 网站建设如何学seo外包公司如何优化
  • 网站换域名做301军事新闻头条
  • 所有网站排名2015年站内优化包括哪些
  • 沈阳市住房和城乡建设局网站网址大全浏览器
  • 怎样办网站宁波seo在线优化方案公司
  • sns网站社区需求分析文档搜索引擎有哪些平台
  • 网站的建设需要虚拟机吗nba最新排行
  • 杨凌住房和城乡建设局网站网站运营怎么做
  • magento做预订类网站杭州网站优化效果
  • 网站背景素材公司网站建设哪家公司好
  • 万网网站后台管理系统青岛谷歌优化公司