From 4a355799baf99612b415fc47fce4b70769188dcb Mon Sep 17 00:00:00 2001 From: codacytesteuser <38557762+codacytesteuser@users.noreply.github.com> Date: Thu, 30 Jul 2026 17:36:38 +0100 Subject: [PATCH] Increase Complexity --- CyclomaticComplexity.java | 180 +++++++++++++++++++++++++++++++------- 1 file changed, 146 insertions(+), 34 deletions(-) diff --git a/CyclomaticComplexity.java b/CyclomaticComplexity.java index 3ef7c57..4755de3 100644 --- a/CyclomaticComplexity.java +++ b/CyclomaticComplexity.java @@ -2,45 +2,65 @@ public class CyclomaticComplexity { public void complex() { for (int i = 0; i < 1000; i++) { - if (i < 100) { + if (i < 100 && i % 2 == 0 || i > 900) { for (int x = 0; x < 1000; x++) { - if (x < 100) { - if (x == 50) { + if (x < 100 && x != 7) { + if (x == 50 || x == 51 || x == 52) { x = 51; + } else if (x == 60 && i > 10) { + x = 61; } else { int y = 12312313; gettingComplex(); for (int f = 0; f < 1000; f++) { - if (f < 100) { + if (f < 100 || f % 3 == 0) { for (int z = 0; z < 1000; z++) { - if (z < 100) { + if (z < 100 && z != 13) { if (z == 50) { z = 51; + } else if (z == 55 || z == 56) { + z = 57; } else { for (i = 0; i < 1000; i++) { - if (i < 100) { + if (i < 100 && y > 0) { for (x = 0; x < 1000; x++) { - if (x < 100) { - if (x == 50) { - x = 51; - } else { - y = 12312313; + if (x < 100 || x == 999) { + switch (x % 5) { + case 0: + x = 51; + break; + case 1: + y = 12312313; + break; + case 2: + y = (x > 50) ? 1 : 2; + break; + case 3: + while (y > 0 && x < 900) { + y--; + } + break; + default: + y = 0; + break; } - } else { int j = 10100; for (i = 0; i < 1000; i++) { - if (i < 100) { + if (i < 100 && j != 0) { for (x = 0; x < 1000; x++) { - if (x < 100) { - if (x == 50) { + if (x < 100 || j > 5) { + if (x == 50 && j % 2 == 0) { x = 51; + } else if (x == 70) { + x = 71; } else { - y = 12312313; + y = (j > 100) ? 12312313 : 42; } - } else { - j = 10100; + do { + j = 10100; + } while (j < 0 || x == -1); } } } @@ -50,18 +70,28 @@ public void complex() { } } } - } else { int l = 10100; + try { + if (l % 2 == 0 && z > 500) { + l = l / (z - z); + } + } catch (ArithmeticException e) { + l = -1; + } catch (RuntimeException e) { + l = -2; + } } } } } } - } else { int j = 10100; gettingComplex(); + if (j > 0 && x % 7 == 0 || i < 5) { + gettingEvenMoreComplex(); + } } } } @@ -70,17 +100,31 @@ public void complex() { public void gettingComplex() { for (int i = 0; i < 1000; i++) { - if (i < 100) { + if (i < 100 || i % 11 == 0) { for (int x = 0; x < 1000; x++) { - if (x < 100) { + if (x < 100 && x != 3) { if (x == 50) { x = 51; + } else if (x == 52 || x == 53) { + x = 54; } else { - int y = 12312313; + int y = (x > 10 && i > 10) ? 12312313 : 1; + while (y > 100000 && x < 999) { + y = y / 2; + } } - } else { int j = 10100; + switch (j % 3) { + case 0: + j++; + break; + case 1: + j--; + break; + default: + j = 0; + } } } } @@ -89,42 +133,110 @@ public void gettingComplex() { public void gettingEvenMoreComplex() { for (int i = 0; i < 1000; i++) { - if (i < 100) { + if (i < 100 && i != 42 || i == 777) { for (int x = 0; x < 1000; x++) { if (x < 100) { - if (x == 50) { + if (x == 50 && i % 2 == 0) { x = 51; + } else if (x == 60 || x == 61 || x == 62) { + x = 63; } else { int y = 12312313; + do { + y--; + } while (y > 0 && x < 50); } - } else { int j = 10100; + try { + if (j > 0 || i > 0) { + j = j % (x - x); + } + } catch (ArithmeticException e) { + j = 0; + } finally { + j = (j < 0) ? 0 : j; + } } } } } } - public void gettingNoItsEqualyComplex() { for (int i = 0; i < 1000; i++) { - if (i < 100) { + if (i < 100 || i % 13 == 0 && i > 3) { for (int x = 0; x < 1000; x++) { - if (x < 100) { + if (x < 100 && x % 4 != 0) { if (x == 50) { x = 51; + } else if (x == 55 && i > 10) { + x = 56; + } else if (x == 57 || x == 58) { + x = 59; } else { int y = 12312313; + for (int k = 0; k < y && k < 10; k++) { + if (k % 2 == 0 || k == 7) { + y -= k; + } + } } - } else { int j = 10100; + while (j > 0 && x < 500) { + if (j % 100 == 0 || j == 1) { + j--; + } else { + j -= 2; + } + } } } } } } - //Second commit - //Thirth commit -} \ No newline at end of file + + public int evenWorse(int a, int b, String mode) { + int r = 0; + if (mode == null || mode.isEmpty()) { + return -1; + } + switch (mode) { + case "add": + r = (a > b) ? a + b : b + a; + break; + case "sub": + r = (a > b && b > 0) ? a - b : b - a; + break; + case "mul": + for (int i = 0; i < a && i < 100; i++) { + if (i % 2 == 0 || i % 3 == 0) { + r += b; + } else if (i % 5 == 0) { + r -= b; + } + } + break; + case "div": + try { + r = (b != 0) ? a / b : 0; + } catch (ArithmeticException e) { + r = -1; + } + break; + default: + while (a > 0 && b > 0) { + if (a > b) { + a -= b; + } else if (b > a) { + b -= a; + } else { + break; + } + } + r = a; + } + return r; + } +}