Java Console Application Projects

How to generate random with weight java

Generating Random Numbers with Weights in Java Random number generation with weighted probabilities is a common requirement in various programming scenarios, such as game development, statistical sampling, and machine learning algorithms. Java provides several approaches to accomplish this task efficiently. in this tutorial To generate random values with weights in Java, you can use a […]

How to generate random with weight java Read More »

Array counting the 0 in Java

Create a 10 element integer array and store some integer values display as the counting of 0. public class JavaEx { public static void main(String args[]) { int numbers[] = {10,15,0,0,6,0,0,1,6,4}; int x,count,len; count = 0; len = numbers.length; for(x= 0; x < len; x++) { if(numbers[x]==0) { System.out.println(numbers[x]); count++; } } System.out.println(count); } }

Array counting the 0 in Java Read More »

DataInputStream using Java

in this tutorials you will be learning  DataInputStream using Java.input the integer number and float number and press enter key then show output as readable integer number and float number. import java.io.DataInputStream; public class JavaEx { public static void main(String args[]) { DataInputStream in = new DataInputStream(System.in); int Intnum = 0; float Floatnum = 0.0f;

DataInputStream using Java Read More »