Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class playfair {
- static char [][] tab= new char[5][5] ;
- public static void tab ()
- {
- int myInt= 65;
- int k=0;
- for (int i = 0; i < tab.length; i++)
- {
- for (int j = 0; j < tab.length; j++)
- {
- tab[i][j]= (char) (myInt +k);
- if (k==8) k=k+2;
- else k++;
- System.out.println(tab[i][j]);
- }
- }
- }
- public static String szukaj(String x)
- {
- String a="";
- for (int i = 0; i < tab.length; i++)
- {
- for (int j = 0; j < tab.length; j++)
- {
- if ((tab[i][j]+"").equals(x)) a=""+(i+1)+","+(j+1);
- }
- }
- return a;
- }
- public static void main(String[] args) {
- tab();
- System.out.println(szukaj("B"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement