Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- class SteamKey
- {
- public static void main (String[] args) throws java.lang.Exception
- {
- String keyout = "";
- int[] keycode = {8, 20, -2, -6, 2, -7, -2, -1, 6, -6, -3, 15, -7, -14, 27};
- int reg = 0;
- int c = 0;
- for(int d : keycode){
- if(c % 5 == 0 && c != 0){
- keyout = keyout + "-";
- }
- c++;
- reg += d;
- if(reg > 9){
- keyout = keyout + getCharForNumber(reg-10);
- }else{
- keyout = keyout + reg;
- }
- }
- System.out.println(keyout);
- }
- public static String getCharForNumber(int i) {
- return i > 0 && i < 27 ? String.valueOf((char)(i + 64)) : null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment