Advertisement
andkamen

salt and pepper

Feb 23rd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. package com.Ch1_ArraysAndStrings;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6. import java.util.Arrays;
  7.  
  8. public class WeirdParser {
  9.     public static void main(String[] args) throws IOException {
  10.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  11.  
  12.         long startingNumber = Long.parseLong(reader.readLine());
  13.         char[] tempArr = Long.toBinaryString(startingNumber).toCharArray();
  14.         char[] num = new char[64];
  15.         Arrays.fill(num, '0');
  16.         System.arraycopy(tempArr, 0, num, num.length - tempArr.length, tempArr.length);
  17.  
  18.         System.out.println(num);
  19.  
  20.         while (true) {
  21.             String[] input = reader.readLine().split(" ");
  22.  
  23.             if ("end".equals(input[0])) {
  24.                 break;
  25.             }
  26.            
  27.             int count = Integer.parseInt(input[1]);
  28.  
  29.             if("salt".equals(input[0])){
  30.                 //do magic
  31.                
  32.             }else{
  33.                 //other magic
  34.             }
  35.  
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement