MCPcopy Create free account
hub / github.com/Ayush7614/Daily-Coding-DS-ALGO-Practice / performDivision

Method performDivision

Gfg/Main.java:36–72  ·  view source on GitHub ↗
(String temp, int s)

Source from the content-addressed store, hash-verified

34 int[][] invK;
35
36 public void performDivision(String temp, int s) {
37 while (temp.length() > s) {
38 String line = temp.substring(0, s);
39 temp = temp.substring(s, temp.length());
40 calLineMatrix(line);
41 if (choice == 1) {
42 multiplyLineByKey(line.length());
43 } else {
44 multiplyLineByInvKey(line.length());
45 }
46 showResult(line.length());
47 }
48 if (temp.length() == s) {
49
50 if (choice == 1) {
51 calLineMatrix(temp);
52 multiplyLineByKey(temp.length());
53 showResult(temp.length());
54 } else {
55 calLineMatrix(temp);
56 this.multiplyLineByInvKey(temp.length());
57 showResult(temp.length());
58 }
59 } else if (temp.length() < s) {
60 for (int i = temp.length(); i < s; i++)
61 temp = temp + 'x';
62 if (choice == 1) {
63 calLineMatrix(temp);
64 multiplyLineByKey(temp.length());
65 showResult(temp.length());
66 } else {
67 calLineMatrix(temp);
68 multiplyLineByInvKey(temp.length());
69 showResult(temp.length());
70 }
71 }
72 }
73
74 public void calKeyMatrix(String key, int len) {
75 km = new int[len][len];

Callers 1

mainMethod · 0.95

Calls 5

calLineMatrixMethod · 0.95
multiplyLineByKeyMethod · 0.95
multiplyLineByInvKeyMethod · 0.95
showResultMethod · 0.95
lengthMethod · 0.80

Tested by

no test coverage detected