Skip to content

Instantly share code, notes, and snippets.

View ricecake-dump's full-sized avatar

ricecake-dump

View GitHub Profile
初期合計値:5170.897049941528
銀行丸目:5171.0
四捨五入:5178.0
ArrayList<Double> randomList = new ArrayList<Double>();
IntStream.range(0, 100).forEach(i -> randomList.add((Double) Math.random() * 100));
double total = randomList.stream().mapToDouble(Double::doubleValue).sum();
System.out.println("初期合計値:" + total);
ArrayList<BigDecimal> bdList = new ArrayList<BigDecimal>();
randomList.stream().forEach(e -> bdList.add(BigDecimal.valueOf(e).setScale(1,BigDecimal.ROUND_HALF_DOWN)));
double total1 = bdList.stream().mapToDouble(f -> f.setScale(0, BigDecimal.ROUND_HALF_EVEN).intValue()).sum();
double total2 = bdList.stream().mapToDouble(f -> f.setScale(0, BigDecimal.ROUND_HALF_UP).intValue()).sum();
System.out.println("銀行丸め:" + total1);
ArrayList<Double> randomList = new ArrayList<Double>();
IntStream.range(0, 100).forEach(i -> randomList.add((Double) Math.random() * 100));
double total = randomList.stream().mapToDouble(Double::doubleValue).sum();
System.out.println("初期合計値:" + total);
ArrayList<BigDecimal> bdList = new ArrayList<BigDecimal>();
randomList.stream().forEach(e -> bdList.add(BigDecimal.valueOf(e).setScale(1,BigDecimal.ROUND_HALF_DOWN)));
double total1 = bdList.stream().mapToDouble(f -> f.setScale(0, BigDecimal.ROUND_HALF_EVEN).intValue()).sum();
double total2 = bdList.stream().mapToDouble(f -> f.setScale(0, BigDecimal.ROUND_HALF_UP).intValue()).sum();
System.out.println("銀行丸め:" + total1);
public static boolean validate(String password){
List<CharacterRule> rules = Arrays.asList(
new CharacterRule(EnglishCharacterData.UpperCase, 1),
new CharacterRule(EnglishCharacterData.LowerCase, 1),
new CharacterRule(EnglishCharacterData.Digit, 1)
);
org.passay.PasswordValidator validator = new org.passay.PasswordValidator(rules);
RuleResult result = validator.validate(new PasswordData(new String(password)));
if(result.isValid()){
compile group: 'org.passay', name: 'passay', version: '1.3.1'
List<CharacterRule> rules = Arrays.asList(
new CharacterRule(EnglishCharacterData.UpperCase, 1),
new CharacterRule(EnglishCharacterData.LowerCase, 1),
new CharacterRule(EnglishCharacterData.Digit, 1)
);
PasswordGenerator generator = new PasswordGenerator();
String password = generator.generatePassword(8, rules);
{
"Version": "2012-10-17",
"Id": "Policy1545355831606",
"Statement": [
{
"Sid": "Stmt1545354895546",
"Effect": "Allow",
"Principal": "*",
"Action": "*",
"Resource": [
"Resource": [
"arn:aws:s3:::[BucketName]/*",
"arn:aws:s3:::[BucketName]"
],
{
"Version": "2012-10-17",
"Id": "Policy1545355831606",
"Statement": [
{
"Sid": "Stmt1545354895546",
"Effect": "Deny",
"Principal": "*",
"Action": "*",
"Resource": [
query search(id: $id) {
getTableA(id:$id) {
id
name
getTableB(id:$id) {
id
{field_parameter}
}
}
}