Advertisement
roronoa

conv to hexa multiply by last char and print last binaryChar

Aug 24th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import java.util.*;
  2. import java.io.*;
  3. import java.math.*;
  4.  
  5. /**
  6.  * Auto-generated code below aims at helping you parse
  7.  * the standard input according to the problem statement.
  8.  **/
  9. class Solution {
  10.  
  11.     public static void main(String args[]) {
  12.         Scanner in = new Scanner(System.in);
  13.         int N = in.nextInt();
  14.         String hex = Integer.toHexString(N);
  15.         hex = "" + hex.charAt(hex.length()-1);
  16.         int fact = Integer.parseInt(hex,16);
  17.         N *= fact;
  18.         String last = Integer.toBinaryString(N);
  19.         //
  20.         System.out.println(last.charAt(last.length()-1));
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement