String Encryption

Encrypts String methods to make Strings unreadable by people trying to view your program!

// Given Input
package dev.sim0n.evaluator.util.stats;

import dev.sim0n.evaluator.util.Log;
import java.util.LinkedList;
import java.util.List;
import java.util.OptionalDouble;

public class Calculations {
    private final List<Integer> intCalculations = new LinkedList();
    private final List<Double> doubleCalculations = new LinkedList();

    public void run(Log log) {
        log.println("\nComputing statistics");
        OptionalDouble intAverage = this.intCalculations.stream().mapToInt(i -> i).average();
        if (!intAverage.isPresent()) {
            throw new AssertionError();
        }
        OptionalDouble doubleAverage = this.doubleCalculations.stream().filter(d -> d != 0.0).mapToDouble(d -> d).average();
        if (!doubleAverage.isPresent()) {
            throw new AssertionError();
        }
        log.print("Averages for (i, d): %s, %s", new Object[]{intAverage.getAsDouble(), doubleAverage.getAsDouble()});
    }

    public int store(int value) {
        this.intCalculations.add((Object)value);
        return value;
    }

    public double store(double value) {
        this.doubleCalculations.add((Object)value);
        return value;
    }

    public List<Integer> getIntCalculations() {
        return this.intCalculations;
    }

    public List<Double> getDoubleCalculations() {
        return this.doubleCalculations;
    }
}

Last updated

Was this helpful?