Advertisement
Guest User

Untitled

a guest
May 20th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. package it.franksisca.test;
  2.  
  3. import org.junit.After;
  4. import org.junit.Before;
  5. import org.junit.Test;
  6.  
  7. public class Custom {
  8.  
  9.     int[] array = { 20, 22, 52, 48, 96, 124, 154, 78, 232, 19, 60, 90, 49, 11, 3, 86, 116, 93, 63, 4 };
  10.  
  11.     @Before
  12.     public void beforeTest() {
  13.         System.out.println("Before");
  14.         System.out.println(array.length);
  15.     }
  16.  
  17.     @After
  18.     public void afterTest() {
  19.         System.out.println("After");
  20.     }
  21.  
  22.     @Test
  23.     public void customTest() {
  24.         for (int i = 0; i < array.length; i++) {
  25.             for (int j = i+1; j < array.length; j++) {
  26.                 if (Math.abs(array[i] - array[j]) % 30 == 0) {
  27.                     System.out.println("Hai trovato due numeri che hanno una diferenza che รจ multiplo di 30");
  28.                     System.out.println("[" + array[i] + " - " + array[j] + "]");
  29.                 }
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement