Advertisement
bogolyubskiyalexey

fiiling text in rect, not equal size

Oct 28th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. package com.company;
  2.  
  3. public class DoubleReshuffleMethod extends CezarCryptoMethods{
  4.     DoubleReshuffleMethod(String text, String xaxis, String yaxis) {
  5.         char [][] array = new char[yaxis.length()][xaxis.length()];
  6.        
  7.         int index = 0;
  8.         for(int j = 0; j < yaxis.length(); ++j){
  9.             for(int k = 0; k < xaxis.length(); ++k) {
  10.                 char ch = ' ';
  11.                 if (index < text.length()) {
  12.                     ch = text.charAt(index++);
  13.                 }
  14.                 array[j][k] = ch;
  15.             }
  16.         }
  17.         for (int i=0; i<yaxis.length(); i++) {
  18.             for (int j=0; j<xaxis.length(); j++)
  19.                 System.out.print(array[i][j]);
  20.             System.out.println();
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement