import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
class Scratch {
public static void main(String[] args) {
String[] shops = {"DE", "CH", "AT", "NL", "FR", "DK", "ES", "IT", "EN", "SE", "NO", "FI", "PT", "BE", "LU", "RO", "GR", "CZ", "PL", "HU"};
List<String> shopList = Arrays.asList(shops);
Collections.shuffle(shopList);
String result = shopList.stream().limit(5).collect(Collectors.joining("+"));
System.out.println(result);
}
}
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import static org.mockito.Mockito.*;
@Configuration
public class MockConfiguration {
@Primary
@Bean
public ActivitiGetTimerValueDelegateService activitiGetTimerValueDelegateService() {
ActivitiGetTimerValueDelegateService service = mock(ActivitiGetTimerValueDelegateService.class);
when(service.getTimerValue(any(), any(), any())).thenReturn(42);
return service;
}
}
INSERT INTO `product_comments` (`product_slug`, `product_id`, `user_id`, `created_at`, `updated_at`, `content`) VALUES ('крем-для-рук-и-ногтей',1,2,'2019-04-08 13:25:31.000000','2019-04-08 13:25:31.000000','Крем вообще супер.')
import java.math.BigInteger;
public class A {
public static void main(String[] args) {
BigInteger output_1 = generate(400732734464L, -74, 12);
BigInteger output_2 = generate(1641401281110016L, 100, 14);
System.out.println(output_1);
System.out.println(output_2);
}
public static BigInteger generate(long val1, int val2, int val3) {
return BigInteger.valueOf(val2 & 255)
.add(BigInteger.valueOf(val1))
.shiftLeft(val3);
}
}