import java.lang.String; import java.lang.Long; import java.math.BigInteger; public class stuff { public static void main(String[] argv) { if (argv.length > 0) { String s = argv[0]; BigInteger input1 = new BigInteger(s, 16); BigInteger mask1 = new BigInteger("18374686479671623680"); BigInteger mask2 = new BigInteger("71776119061217280"); BigInteger mask3 = new BigInteger("69269232549888"); BigInteger mask4 = new BigInteger("4278190080"); BigInteger mask5 = new BigInteger("16711680"); BigInteger mask6 = new BigInteger("65280"); BigInteger mask7 = new BigInteger("255"); BigInteger section1 = BigInteger.valueOf(0); BigInteger section2 = BigInteger.valueOf(0); BigInteger section3 = BigInteger.valueOf(0); BigInteger section4 = BigInteger.valueOf(0); BigInteger section5 = BigInteger.valueOf(0); BigInteger section6 = BigInteger.valueOf(0); BigInteger section7 = BigInteger.valueOf(0); BigInteger section1s = BigInteger.valueOf(0); BigInteger section2s = BigInteger.valueOf(0); BigInteger section3s = BigInteger.valueOf(0); BigInteger section4s = BigInteger.valueOf(0); BigInteger section5s = BigInteger.valueOf(0); BigInteger section6s = BigInteger.valueOf(0); BigInteger section7s = BigInteger.valueOf(0); section1 = (input1.and(mask1)); section1s = section1.shiftRight(30); section2 = (input1.and(mask2)); section2s = section2.shiftRight(14); section3 = (input1.and(mask3)); section3s = section3.shiftLeft(2); section4 = (input1.and(mask4)); section4s = section4.shiftRight(30); section5 = (input1.and(mask5)); section5s = section5.shiftRight(14); section6 = (input1.and(mask6)); section6s = section6.shiftLeft(2); section7 = (input1.and(mask7)); section7s = section7.shiftLeft(18); BigInteger output = section1s.add(section2s.add(section3s.add(section4s.add(section5s.add(section6s.add(section7s)))))); System.out.println("Output: " + output); } else { System.out.println("usage: hexadecimal"); } } }