Java Bug, March 27th, 2023

double progress=200/600;

debugged is showing as progress = 0;

casted as a double give 0.33333

Seems like I shouldn't have to cast in this case

double progress1 = 200/600;
double progress2 = 200/600.0;

Both compile
progress1 gives 0
progress2 gives 0.33333 as expected

If your meal, your resources where waiting on progress to be 600/600? Would you like the system to if that?

Created an app that combines Flashcards and Measures Typing in JavaFX, Free Starter Class, MIT License

package application;

import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import java.util.logging.Logger;

import data.InputValidationUtil;
import data.StringParseUtil;
import file.FileUtil;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
import performance.PerformanceUtil;
import random.RandomUtil;


public class FlashCardsApp extends Application {
	private static Logger logger = Logger.getLogger(FlashCardsApp.class.getName());
	
	private int currentTerm=0;
	
	Scene scene;
	
	VBox vbox;
	HashMap<String, String> termDefinitionMap = new HashMap<>();
	Label termLabel;
	TextFlow textFlow = new TextFlow();
	Text definitionLabel = new Text();
	String keyArray[];
	TextField textField = new TextField();
	Label potentialMismatch = new Label();
	Label instructionLabel;
	
	Label typingSpeedLastAttemptLabel = new Label("Typing Speed Last Attempt: 0.0 WPM");
	Label typingSpeedLabel = new Label("Typing Average Speed: 0.0 WPM");
	Label typingSpeedMaxThroughputAchievedLabel = new Label("Max Typing Throughput Achieved: 0.0 WPM");
	Label neverSayDieLabel = new Label("Never Say Die!");	
	boolean timerStarted=false;
	ArrayList<String> flaggedMismatches = new ArrayList<>();
	int totalWordsTypedAndVerified=0;
	
	PerformanceUtil OverallTime = new PerformanceUtil();
	
	ArrayList<Canvas> progressBarCanvases = new ArrayList<>();
	
	Label wordsTyped = new Label("0/600");
	
	
	public void canvasToColor(Canvas canvas, String colorString) {
		Color color = Color.valueOf(colorString);
		GraphicsContext graphicsContext = canvas.getGraphicsContext2D();
		graphicsContext.setFill(Paint.valueOf(color.toString()));
		graphicsContext.fillRect(0, 0, 25, 25);
	}
	
	public void setupProgressBar() {
		HBox progressBar = new HBox();
		
		for (int i=0; i<10; i++) {
			Canvas canvas = new Canvas(25,25);
			canvasToColor(canvas, "#EEFFEE");
			progressBarCanvases.add(canvas);
			progressBar.getChildren().add(canvas);
		}
		progressBar.setMinWidth(250);
		vbox.getChildren().add(progressBar);
		wordsTyped.setPadding(new Insets(0, 0, 0, 10));
		wordsTyped.setMinWidth(150);
		// wordsTyped.setTextAlignment(TextAlignment.RIGHT);
		wordsTyped.setFont(Font.font(16));
		progressBar.getChildren().add(wordsTyped);
	}
	
	public void updateProgressBar(double progress) {
		double elementsToTurnOn = progress*10;
		int index = (int) elementsToTurnOn;
		
		for (int i=1; i<=elementsToTurnOn; i++) {
			canvasToColor(progressBarCanvases.get(i-1),"#AAFFAA");
		}
		
		wordsTyped.setText(totalWordsTypedAndVerified+"/600");
	}
	
	private void updateProgress() {
		double progress = (double) totalWordsTypedAndVerified/600;
		updateProgressBar(progress);
	}
	
	
	private void resizeEvent() {
	    double newWidth = scene.getWidth()-50;
		termLabel.setMinWidth(newWidth);
		instructionLabel.setMinWidth(newWidth);
		textFlow.setMinWidth(newWidth);
		textFlow.setMaxWidth(newWidth);
		definitionLabel.setWrappingWidth(newWidth);		
		textField.setMinWidth(newWidth);
	}
	
	@Override
	public void start(Stage primaryStage) {
		try {
			BorderPane root = new BorderPane();
			scene = new Scene(root,400,400);
			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
			primaryStage.setScene(scene);
			primaryStage.show();
			
			primaryStage.setTitle("Flash Card Definition Typing Throughput");
			
			vbox = new VBox();
			vbox.getStyleClass().clear();
			vbox.getStyleClass().add("mainElementCustomClass");
			root.getChildren().add(vbox);
			setupProgressBar();
			
			logger.info("Working path: "+FileUtil.getWorkingPath());
			String economicTerms = FileUtil.readFileAsString("src\\main\\resources\\economicsTerms.txt");			
			
			String lines[] = economicTerms.split("\n");
			
			for (int i=0; i<lines.length; i++) {
				String elements[] = lines[i].split(" - ");
				termDefinitionMap.put(elements[0], elements[1]);
			}
			
			termDefinitionMap.forEach((term,def) -> {
				logger.info("\nTerm: "+term+"\n"+def+"\n");
			});
						
			Set<String> keys = termDefinitionMap.keySet();
			currentTerm = RandomUtil.getRandomNumber(0, keys.size());
			keyArray = keys.toArray(new String[0]);
			termLabel = new Label("Term: "+keyArray[currentTerm]);
			termLabel.setFont(Font.font(25));
			String definition = termDefinitionMap.get(keyArray[currentTerm]).trim();
			definitionLabel.setText("Definition: "+definition);

			
			
			
			Button button = new Button("Next");
			button.setOnAction((event) -> next() );
			
			button.setMinWidth(200);
			termLabel.setMinWidth(200);
			
			textFlow.setMinWidth(scene.getWidth()-50);
			textFlow.setMaxWidth(scene.getWidth()-50);
			definitionLabel.setWrappingWidth(scene.getWidth()-50);
			
			scene.widthProperty().addListener((obs,oldValue,newValue) -> {
				resizeEvent();
			});;
			
			textFlow.getChildren().add(definitionLabel);
			vbox.getChildren().addAll(termLabel,textFlow);
			
			
			textField.setPrefWidth(scene.getWidth());
			
			textField.setOnKeyReleased((event) -> {
				KeyEvent keyEvent = (KeyEvent) event;
				
				if (keyEvent.getCode()==KeyCode.ENTER) {
					System.out.println("Enter Key Released");
					String string1 = textField.getText().trim();
					String string2 = termDefinitionMap.get(keyArray[currentTerm]).trim();
					System.out.println("String 1: "+string1);
					System.out.println("String 2: "+string2);
					
					if (string1.compareTo(string2)==0) {						
						totalWordsTypedAndVerified+=StringParseUtil.getWordCount(string1);
						updateProgress();
						if (!firstGoalAchieved&&totalWordsTypedAndVerified>=600) {
							firstGoal();
						}
						logger.info("totalWordsTypedAndVerified = "+totalWordsTypedAndVerified);
						potentialMismatch.setVisible(false);
						next();
						textField.setStyle("-fx-focus-color: #00CCFF");
					} else {
						textField.setStyle("-fx-focus-color: #FF0000");
						String mismatch = InputValidationUtil.flagPotentialMismatches(string2, string1);
						potentialMismatch.setText("Potential Mismatch: "+mismatch);
						potentialMismatch.setVisible(true);
						flaggedMismatches.add(mismatch);
						
					}
				}
				
				if (keyEvent.getCode()==KeyCode.ESCAPE) {
					String mismatches = getMismatches();
					logger.info("Mismatches: "+mismatches);
					Alert alert = new Alert(AlertType.INFORMATION);
					alert.setTitle("Flagged Mismatches");
					alert.setHeaderText("Flagged Mismatches");
					alert.setContentText(mismatches);
					alert.show();					
				}
				
				if (!timerStarted) {
					OverallTime.startInstant();
					PerformanceUtil.getInstance().startInstant();
					timerStarted = true;
				}
			});
			
			instructionLabel = new Label("Type the definition in the space below to present the next term");
			
			vbox.getChildren().addAll(potentialMismatch,instructionLabel,textField,typingSpeedLastAttemptLabel,typingSpeedLabel);
			vbox.getChildren().addAll(typingSpeedMaxThroughputAchievedLabel, neverSayDieLabel);
			
			vbox.autosize();
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	boolean firstGoalAchieved = false;
	
	private void firstGoal() {
		OverallTime.stopInstant();
		long timeInMilliseconds = OverallTime.getInstantDifferenceMilliseconds();
		double seconds = timeInMilliseconds/1000;
		double minutes = seconds/60;
		firstGoalAchieved = true;
		Alert alert = new Alert(AlertType.INFORMATION);
		alert.setTitle("Words Typed: "+totalWordsTypedAndVerified);
		alert.setHeaderText("Words Typed: "+totalWordsTypedAndVerified);
		
		double wordsPerMinute = totalWordsTypedAndVerified/minutes;
		
		String wpmContent = totalWordsTypedAndVerified+" words typed over a period of "
			    +String.format("%.1f", seconds)+" seconds, "
			    +String.format("%.1f", minutes)+" minutes. "
			    +String.format("%.1f", wordsPerMinute)+" WPM Words per Minute";
		
		TextFlow textFlow = new TextFlow();
		Text text = new Text(wpmContent);
		textFlow.setMaxWidth(350);
		textFlow.setPadding(new Insets(20));		
		text.setWrappingWidth(350);
		textFlow.getChildren().add(text);
		alert.getDialogPane().setMaxWidth(350);
		alert.getDialogPane().setContent(textFlow);
		alert.show();
		logger.info(wpmContent);
	}
	
	private String getMismatches() {
		final StringWriter stringWriter = new StringWriter();
		
		flaggedMismatches.stream().forEach((word) -> stringWriter.append(word+", "));
		String mismatches = stringWriter.toString().trim();
		mismatches = mismatches.substring(0,mismatches.length()-1);
		return mismatches;
	}
	
	private class TypingSpeed {		
		long timeInMilliseconds;
		int words;
		double WPM;
	}
	
	ArrayList<TypingSpeed> typingSpeedReadings = new ArrayList<>();
	
	double max = 0;
	
	private void updateTypingSpeed() {
		long timeInMilliseconds = PerformanceUtil.getInstance().getInstantDifferenceMilliseconds();
		String sentence = textField.getText().trim();
		String words[] = sentence.split(" ");
		
		TypingSpeed typingSpeed = new TypingSpeed();
		typingSpeed.timeInMilliseconds = timeInMilliseconds;
		typingSpeed.words = words.length;
		
		double seconds = timeInMilliseconds/1000;
		double minutes = seconds/60;
		typingSpeed.WPM = typingSpeed.words/minutes;
		
		typingSpeedReadings.add(typingSpeed);
		
		double sum=0;
		for (int i=0; i<typingSpeedReadings.size(); i++) {
			sum+=typingSpeedReadings.get(i).WPM;
		}
		
		double averageWPM = sum/typingSpeedReadings.size();
		
		typingSpeedLastAttemptLabel.setText("Typing Speed Last Attempt: "+String.format("%.1f",typingSpeed.WPM)+" WPM");
		typingSpeedLabel.setText("Typing Speed Average: "+String.format("%.1f",averageWPM)+" WPM");
		
		if (typingSpeed.WPM>max) {
			max = typingSpeed.WPM;
		}
		
		typingSpeedMaxThroughputAchievedLabel.setText("Max Typing Throughput Achieved: "+String.format("%.1f", max)+" WPM");
		
		
		logger.info("Typing Speed Average: "+String.format("%.1f",averageWPM)+" WPM");
	}
	
	private void next() {		
		PerformanceUtil.getInstance().stopInstant();
		timerStarted = false;
		System.out.println("Time required to type: "+PerformanceUtil.getInstance().getInstantDifferenceMilliseconds()+" ms");
		
		updateTypingSpeed();
		
		System.out.println("Next card called");
		textField.setText("");
		if (currentTerm>=keyArray.length-1) {
			currentTerm=0;
		} else {
			currentTerm++;
		}

		termLabel.setText("Term: "+keyArray[currentTerm]);
		String definition = termDefinitionMap.get(keyArray[currentTerm]).trim();
		definitionLabel.setText("Definition: "+definition);
		
		PerformanceUtil.getInstance().startInstant();
		timerStarted = true;
	}
	
	public static void main(String[] args) {
		launch(args);
	}
}

loads the file economicTerms.txt, the name of the file can be changed, I provide the example file, Max Profit could be defined better, not all terms are economic specific terms

Interest - a sum paid or charged for the use of money or for borrowing money
Gross Domestic Product - gross national product excluding payments on foreign investments.
Liquidity - the ability or ease with which assets can be converted into cash
Relevance - the condition of being relevant, or connected with the matter at hand
Free Java App - Cross training typing and definitions with an emphasis on Throughput
Most Common Words in English - the be to of and, a in that have I, it for not on with, he as you do at
Throughput - actual transfer of data that can be up to bandwidth but is not usually to the level of bandwidth
Bandwidth - maximum possible transfer of data
Focus - a central point, as of attraction, attention, or activity
Concise Communication - communication that is concise
Active Listening - listening to speaker in a focused attentive way
Linguistics - the science of language, including phonetics, phonology, morphology, syntax, semantics, pragmatics, and historical linguistics.
Maximize Profit - maximize profit
Pecuinary - adjective, of or relating to money
Investment - the investing of money or capital in order to gain profitable returns, as interest, income, or appreciation in value.
Free Market - an economic system in which prices and wages are determined by unrestricted competition between businesses, without government regulation or fear of monopolies.
Opportunity Cost - the money or other benefits lost when pursuing a particular course of action instead of a mutually-exclusive alternative
Equity - ownership, especially when considered as the right to share in future profits or appreciation in value.
Commodity - an article of trade or commerce, especially a product as distinguished from a service.
Assets - items or resources owned by a person, business, or government, as cash, notes and accounts receivable, securities, inventories, goodwill, fixtures, machinery, or real estate (opposed to liabilities)
Phonetics - the science or study of speech sounds and their production, transmission, and reception, and their analysis, classification, and transcription.  Compare acoustic phonetics, articulatory phonetics, auditory phonetics, physiological phonetics.
Semantics - the study of meaning, the study of linguistic development by classifying and examining changes in meaning and form.
Syntax - the study of the rules for the formation of grammatical sentences in a language.
Morphology - the patterns of word formation in a particular language, including inflection, derivation, and composition. 
Phonology - the study of the distribution and patterning of speech sounds in a language and of the tacit rules governing pronunciation.
Pragmatics - the analysis of language in terms of the situational context within which utterances are made, including the knowledge and beliefs of the speaker and the relation between speaker and listener.
Accuracy - how close you get to the true, exact value. Hitting the Bull's-eye on a target is accurate.
Precision - consistent, repeatable results that factor into to ability to increase accuracy.  Hitting same spot on target on repeated attempts is precise.
Velocity - the time rate of change of position of a body in a specified direction.
Watt - the standard unit of power in the International System of Units (SI), equivalent to one joule per second and equal to the power in a circuit in which a current of one ampere flows across a potential difference of one volt. Abbreviation: W, w.
Joule - the standard unit of work or energy in the International System of Units (SI), equal to the work done by a force of one newton when its point of application moves through a distance of one meter in the direction of the force: equivalent to 107 ergs and one watt-second. Abbreviations: J, j
Efficiency - the ratio of the work done or energy developed by a machine, engine, etc., to the energy supplied to it, usually expressed as a percentage.
Volt - the standard unit of potential difference and electromotive force in the International System of Units (SI), formally defined to be the difference of electric potential between two points of a conductor carrying a constant current of one ampere, when the power dissipated between these points is equal to one watt. Abbreviation: V
Ampere - the basic unit of electrical current in the International System of Units (SI), equivalent to one coulomb per second, formally defined to be the constant current which if maintained in two straight parallel conductors of infinite length, of negligible circular cross section, and placed one meter apart in vacuum, would produce between these conductors a force equal to 2x10^-7 newton per meter of length. Abbreviation: A, amp.
Farad - the standard unit of capacitance in the International System of Units (SI), formally defined to be the capacitance of a capacitor between the plates of which there appears a potential difference of one volt when it is charged by a quantity of electricity equal to one coulomb. Symbol: F
Induction - Electricity, Magnetism. the process by which a body having electric or magnetic properties produces magnetism, an electric charge, or an electromotive force in a neighboring body without contact.  Compare electromagnetic induction, electrostatic induction.
Magnet - a body, as a piece of iron or steel, that possesses the property of attracting certain substances, as iron.
Magnetism - the properties of attraction possessed by magnets; the molecular properties common to magnets.
Acceleration - the act of accelerating; increase of speed or velocity.  Mechanics. the time rate of change of velocity with respect to magnitude or direction; the derivative of velocity with respect to time.
Gravity - the force of attraction by which terrestrial bodies tend to fall toward the center of the earth. a unit of acceleration equal to the acceleration of gravity. Symbol: g
Activation Energy - the least amount of energy required to activate atoms or molecules to a state in which they can undergo a chemical reaction.

Relies on a Utility Library I plan to provide to github or other sites once more enabled. Would provide screenshots, maybe will provide some on twitter

Relies on PerformanceUtil also MIT License

package performance;

import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;

public class PerformanceUtil {
	private ArrayList<PerformanceReading> performanceReadings = new ArrayList<>();
	private boolean stopWatchStarted = false;
	public boolean isStopWatchStarted() {
		return stopWatchStarted;
	}

	private long startTime;
	private long endTime;
	private long recordedTime=0;
	private static PerformanceUtil instance;
	
	public static PerformanceUtil getInstance() {
		if (null == instance) {
			instance = new PerformanceUtil();
		}
		
		return instance;
	}
	
	private Instant start;
	private Instant stop;
	
	public void startInstant() {
		start = Instant.now();
	}
	
	public void stopInstant() {
		stop = Instant.now();
	}
	
	public long getInstantDifferenceMilliseconds() {
		return Duration.between(start, stop).toMillis();
	}
	
	public boolean start() {
		if (stopWatchStarted) {
			return false;
		} else {
			startTime=System.nanoTime();
			stopWatchStarted=true;
			return true;
		}
	}
	
	public boolean stop() {
		if (!stopWatchStarted) {
			return false;
		} else {
			endTime=System.nanoTime();
			stopWatchStarted=false;
			return true;
		}
	}
	
	public long getRunningTime() {
		long runningTime = System.nanoTime()-startTime;
		return runningTime;
	}
	
	public long getRecordedTime() {
		recordedTime=endTime-startTime;
		return recordedTime;
	}
	
	public int getRecordedTimeMilliseconds() {
		recordedTime=endTime-startTime;
		double milliseconds = recordedTime/1000000;
		return (int) milliseconds;
	}	
	
	public void clearPerformanceReadingsList() {
		performanceReadings = new ArrayList<>();		
	}
	
	public void addPerformanceReading(String performanceReadingName) {
		long recordedTime = getRecordedTime();
		PerformanceReading performanceReading = new PerformanceReading(recordedTime, performanceReadingName);
		performanceReadings.add(performanceReading);		
	}
	
	public PerformanceReading summarizePerformanceReadings(String readingName, ArrayList<PerformanceReading> readings) {
		if (readings.size()>0) {
			long sum=0;
			for (int i=0; i<readings.size(); i++) {
				sum = readings.get(i).getNanoseconds();			
			}
			long average = sum/readings.size();
			
			return new PerformanceReading(average, readingName);
		} else {
			return null;
		}
	}
	
	public ArrayList<PerformanceReading> getPerformanceReadings() {
		return performanceReadings;
	}
	
	public static PerformanceReading runAndTime(String name, Runnable method) {
		PerformanceUtil perfUtil = new PerformanceUtil();
		perfUtil.startInstant();
		method.run();
		perfUtil.stopInstant();
		PerformanceReading performanceReading = new PerformanceReading(0, name);
		String timingMessage = "System required "+perfUtil.getInstantDifferenceMilliseconds()+" ms to execute "+name;
		performanceReading.setMilliseconds(perfUtil.getInstantDifferenceMilliseconds());
		performanceReading.setMessage(timingMessage);
		return performanceReading;
	}
}
package performance;

public class PerformanceReading {
	
	public PerformanceReading(final long nanoseconds, final String name) {
		this.nanoseconds = nanoseconds;
		this.name = name;
	}
	
	private long nanoseconds;
	private String name;
	private String message;
	
	public String getMessage() {
		return message;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}
	
	public String toString() {
		return message;
	}
	
	public long getNanoseconds() {
		return nanoseconds;
	}
	
	public long getMilliseconds() {
		return TimeMeasurementUtil.convertNanosecondsToMilliseconds(nanoseconds);
	}
	
	public void setMilliseconds(long milliseconds) {
		nanoseconds = TimeMeasurementUtil.convertMillisecondsToNanoseconds(milliseconds);
	}
	
	public String getName() {
		return name;
	}	
}

and FileUtil, InputValidationUtil, StringParseUtil, and RandomUtil also MIT License

package file;

import java.awt.image.RenderedImage;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.util.logging.Logger;

import javax.imageio.ImageIO;

public class FileUtil {
	private static Logger logger = Logger.getLogger(FileUtil.class.toString());
	
	public static String getWorkingPath() {
		File file = new File("");
		String path = file.getAbsolutePath().toString();
		return path;
	}
	
	public static String readFileAsString(String fileName) throws FileNotFoundException, IOException {
		final StringWriter stringWriter = new StringWriter();
		
		File file = new File(fileName);
		BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
		stringWriter.append(new String(bis.readAllBytes()));
		bis.close();
		
		return stringWriter.toString();
	}
	
	public static void writeFile(String fileName, String fileAsString) throws IOException {
		File file = new File(fileName);
		FileWriter fileWriter = new FileWriter(file);
		fileWriter.write(fileAsString);
		fileWriter.close();
		
		logger.info("Wrote to "+fileName+" with "+fileAsString.getBytes().length+" bytes.");
	}
	
	public static void writeBitmap(RenderedImage renderedImage, String fileName) throws IOException {
		File file = new File(fileName);		
		ImageIO.write(renderedImage, "BMP", file);
	}
}
package data;

import java.util.List;

public class InputValidationUtil {
	
	public static String flagPotentialMismatches(String sentence, String input) {
		List<String> wordsInSentence = StringParseUtil.sentenceToWordsList(sentence);
		List<String> wordsInInput = StringParseUtil.sentenceToWordsList(input);
		
		for (int i=0; i<wordsInSentence.size(); i++) {
			String word = wordsInSentence.get(i);
			if (i<wordsInInput.size()) {
				if (word.compareTo(wordsInInput.get(i))!=0) {
					return word;
				}
			} else {
				return "";
			}
		}
		
		return "";	    
	}
}
package data;

import java.util.List;

public class StringParseUtil {
	public static List<String> sentenceToWordsList(String sentence) {
		List<String> words = List.of((sentence).split(" "));
		return words;
	}
	
	public static String removePeriod(String sentence) {
		return sentence.trim().replaceFirst(".", "");
	}
	
	public static int getWordCount(String sentence) {
		sentence = sentence.trim();
		String words[] = sentence.split(" ");
		return words.length;
	}

}
package random;

import java.util.ArrayList;
import java.util.OptionalDouble;
import java.util.random.RandomGenerator;
import java.util.random.RandomGeneratorFactory;
import java.util.stream.DoubleStream;

public class RandomUtil {
	private static RandomGenerator randomGenerator = RandomGeneratorFactory.getDefault().create();
	public static ArrayList<String> getRandomList(ArrayList<String> listOfStrings, int size) {
		DoubleStream doubleStream = randomGenerator.doubles(size);
		
		ArrayList<String> randomList = new ArrayList<>();
		
		doubleStream.forEach((random) -> {
			int value = Double.valueOf(listOfStrings.size()*random).intValue();
			randomList.add(listOfStrings.get(value));
		});
		
		return randomList;
	}
	
	public static String getRandomElementInListOfStrings(ArrayList<String> listOfStrings) {
		DoubleStream doubleStream = randomGenerator.doubles(1);
		
		OptionalDouble random = doubleStream.findFirst();
		int value = Double.valueOf(listOfStrings.size()*random.getAsDouble()).intValue();
		String randomElementString = listOfStrings.get(value);		
		return randomElementString;		
	}
	
	public static int getRandomNumber(int lowerBound, int upperBound) {
		return randomGenerator.nextInt(lowerBound, upperBound);
	}
}

I have posted some test cases for RandomUtil on other vlog posts.

I believe it to be a useful app for cross training definitions and typing speed, though concentrating on typing speed might not be all comprehension of terms amplified. Kind of like taking notes, some pass through potential for not all comprehension amped.

10% increased typing speed for all programmers and engineers, all teachers and doctors? could be a lot of power added

Computers more useful potential for greater sales

Potential to amp processing cycles substantially

Ability to type, factors into ability to magnify message, to deliver Throughput and Reach, to write scripts and speeches that factor into support

Amping Typing probably wise to Amp Ergonomics as well a labor of love and a risk mitigation strategy

https://www.pcmag.com/picks/the-best-ergonomic-keyboards

  1. I don’t want people to get carpel tunnel.
  2. I want people to be enabled and empowered. I believe faster typing has the ability to enable and empower though it is imperative for the World to be a less corrupt place for people to be able to capitalize on that empowerment.

https://www.logitech.com/en-us/products/keyboards/k860-split-ergonomic.920-009166.html

https://www.logitech.com/en-us/ergo/design-lab.html

Cybersecurity problems amp Anxiety, not sure all realize that a lot of work that has been added to amplify better ergonomics can be reduced when cybersecurity and trust is robbed.

Good User Experience is costly, like a clean hotel room.

Hackers like someone coming in and taking a shit on the bed before you walk into the room.

Good experience Bandwidth vs Throughput on Shiny Blue Marble?

Letting corrupt governments oppress experience is a short term solution that has high potential for losses to effectiveness and blow back.

My email accounts and access to phones have been limited in a dangerous way. Not sure those responsible might appreciate the same being done to their support lines.

Published by techinfodebug

Flex and Java Developer, Christian, Art, Music, Video, and Vlogging

Leave a comment