public class LetCode {public static void main(String[] args) {int asd = (int) (10 - -10_01.99);System.out.println(asd);//String getScreenSerialNumber = "2190612310400005";String strUrl = "http://checkin.sanyevi.cn:6688/" + getScreenSerialNumber+ "/updateFile.tar.gz";System.out.println(strUrl);//http://checkin.sanyevi.cn:6688/SY48500000344/updateFile.tar.gz// sb.append(String.format("%02d", bean.getAirConditioningAuto()));getAirConditionByte3(1,2,3);System.out.println(Integer.parseInt(Long.MAX_VALUE+""));}/*** byte2*/public static int getAirConditionByte3(int ... a) {for (int i = 0; i < a.length; i++) {System.out.println("getAirConditionByte3:"+a[i]);}StringBuilder sb = new StringBuilder();int testV=9;String bitStr = Integer.toBinaryString(testV);sb.append(addZeroForNum(bitStr, 8));System.out.println(sb.toString());int result = Integer.parseInt(sb.toString(), 2);System.out.println(result);return result;}public static String addZeroForNum(String str, int strLength) {int strLen = str.length();if (strLen < strLength) {while (strLen < strLength) {StringBuffer sb = new StringBuffer();sb.append("0").append(str);// 左补0// sb.append(str).append("0");//右补0str = sb.toString();strLen = str.length();}}return str;}void test1() {// -98short s0 = -98;short s1 = 117;short s2 = -98;short s3 = 117;long a = LetCode.getIntFromByte(s0, s1, s2, s3);double b = LetCode.getFloatFromByte(158, 117, 158, 117);System.out.println(a);System.out.println(b);System.out.println(-0 & 0xff);System.out.println(Byte.MAX_VALUE);System.out.println(Byte.MIN_VALUE);String s = "a";boolean ignore = s.equalsIgnoreCase("A");System.out.println(ignore);//}public static long getIntFromByte(short byte0, short byte1, short byte2, short byte3) {byte0 = (short) (byte0 & 0xff);byte1 = (short) (byte1 & 0xff);byte2 = (short) (byte2 & 0xff);byte3 = (short) (byte3 & 0xff);//03 20 00 00long ret;ret = byte3;ret &= 0xff;ret |= ((long) byte2 << 8);ret &= 0xffff;ret |= ((long) byte1 << 16);ret &= 0xffffff;ret |= ((long) byte0 << 24);// int d0 = byte0 << 24;// int d1 = byte1 << 16;// int d2 = byte2 & 0xff << 8;// int d3 = byte3 & 0xff << 0;// ret = d0 | d1 | d2 | d3;return ret;}public static double getFloatFromByte(int byte0, int byte1, int byte2, int byte3) {long ret;ret = byte3;ret &= 0xff;ret |= ((long) byte2 << 8);ret &= 0xffff;ret |= ((long) byte1 << 16);ret &= 0xffffff;ret |= ((long) byte0 << 24);double v = Double.longBitsToDouble((long) ret);return v;}/*** Byte转Bit*/public static String byteToBit(byte b) {return "" +((b >> 7) & 0x1) +((b >> 6) & 0x1) +((b >> 5) & 0x1) +((b >> 4) & 0x1) +((b >> 3) & 0x1) +((b >> 2) & 0x1) +((b >> 1) & 0x1) +((b >> 0) & 0x1);}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。