Guest User

Steam Key

a guest
Aug 10th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class SteamKey
  6. {
  7.     public static void main (String[] args) throws java.lang.Exception
  8.     {
  9.         String keyout = "";
  10.         int[] keycode = {8, 20, -2, -6, 2, -7, -2, -1, 6, -6, -3, 15, -7, -14, 27};
  11.         int reg = 0;
  12.         int c = 0;
  13.         for(int d : keycode){
  14.             if(c % 5 == 0 && c != 0){
  15.                 keyout = keyout + "-";
  16.             }
  17.             c++;
  18.             reg += d;
  19.             if(reg > 9){
  20.                 keyout = keyout + getCharForNumber(reg-10);
  21.             }else{
  22.                 keyout = keyout + reg;
  23.             }
  24.         }
  25.         System.out.println(keyout);
  26.        
  27.     }
  28.     public static String getCharForNumber(int i) {
  29.         return i > 0 && i < 27 ? String.valueOf((char)(i + 64)) : null;
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment