Skip to content

Instantly share code, notes, and snippets.

@QuantumHawk
Created January 30, 2015 15:32
Show Gist options
  • Save QuantumHawk/9148355b1e450eef8b2c to your computer and use it in GitHub Desktop.
Save QuantumHawk/9148355b1e450eef8b2c to your computer and use it in GitHub Desktop.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String _alphabet = "ЙЦУКЕНГШЩЗХФЪЫВАПРОЛДЖЭЧСМИТЬБЮ";
String _line= "";
char[] digit = _line.toLowerCase().toCharArray();// чар нижний
String _cryptedString = "";
Random r = new Random();
int [] l = new int[] {11, 18, 25, 2, 9, 10, 12, 19, 21, 3, 4, 6, 13, 20, 22, 23, 5, 7, 14, 16, 17, 24, 1, 8, 15};
for (int i = 0; i < 25; i++)
{
if (( digit[i]- 1) < l.length )
{
digit[i] = (char) (l[i] - 1);
_cryptedString += digit[(char)(l[i]- 1)];
jTextArea1.append(_cryptedString.toString());
}
else
{
char _randomChar = _alphabet.charAt(r.nextInt(_alphabet.length()-1));
// Console.Write(_randomChar + "\t");
_cryptedString += _randomChar;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment