pastebin

Paste Search Dynamic
Recent pastes
charAt
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Main
  9. {
  10.         public static void main (string[] args) throws java.lang.exception
  11.         {
  12.                 string in = "A12345F7";
  13.                 char[] out = new char[33];
  14.                 int j = 0;
  15.         for(int i = 0; i < in.length(); i++)
  16.         {
  17.                 char c = in.charAt(i);
  18.                 if (c > '9') c -= 'A' - '9' - 1;
  19.                 for(int bit = 8; bit != 0; bit >>= 1)
  20.                 out[j++] = ((c & bit) != 0) ? '1' : '0';
  21.         }
  22.         system.out.println(out);
  23.         }
  24. }
Parsed in 0.022 seconds