Java Hex Convert To convertHexTime2Binary(String timespan)

Here you can find the source of convertHexTime2Binary(String timespan)

Description

convert Hex Time Binary

License

Apache License

Declaration

public static String convertHexTime2Binary(String timespan) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String convertHexTime2Binary(String timespan) {
        if (timespan == null || timespan.equals("")) {
            return "";
        }/*from   ww  w  .j a  va2 s  .  c o  m*/

        String tmp = "";
        String ret = "";
        String[] strArr = timespan.split(",");
        for (int i = 0; i < strArr.length; i++) {
            String binStr = Long.toBinaryString(Long.parseLong(strArr[i], 16));
            if (binStr.length() < 32) {
                int length = binStr.length();
                for (int n = 0; n < 32 - length; n++) {
                    binStr = "0" + binStr;
                }
            }
            tmp += binStr;
        }

        for (int i = 0; i < 48; i++) {
            ret += tmp.charAt(i * 2);
        }

        return ret;
    }
}

Related

  1. convertHexChars(final String value)
  2. convertHexColorToRgb(final String hex)
  3. convertHexFloatingPointLiteralToBits(char[] source)
  4. convertHexLong(String hex)
  5. convertHexStringToBinary(String hexString)
  6. convertHextoASCII(String text)
  7. convertHexToChar(String hex)
  8. convertHexToFloat(long hexValue)
  9. fromHex(byte[] hex)