convert to lower of nearest 1000 in java [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
convert to lower of nearest 1000 in java
I want to convert to lower 1000 example
4300 should be 4000
4900 should be 4000
10050 should be 10000
how can we do this using java
sorry for the bad english

int value = …
int nearestThousand = value / 1_000 * 1_000;

Related

Regex matching an hyphen separated range [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 23 hours ago.
Improve this question
I have 2 different range expressions as follows:
1 - 10 cm
5+ m
and I'd like to extract min, max and unit from these expressions using Regex (where I am a newbie at), like:
Integer min = 1
Integer max = 10
String unit = "cm"
and
Integer min = 5
Integer max = null
String unit = "m"
respectively. Is it possible to do it using one pattern, if so how?
Thanks in advance...

Permutations of array with at minimum 1 element [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 17 days ago.
Improve this question
I am trying to produce all permutations of an array of size N (i.e. N = 9) with possible elements Z (i.e. Z = [0,1,2,3,4])
Duplicates are allowed, but there needs to be at least one. I am able to write the algorithm to go through all possibilities but the minimum of at least one of each of Z is the part I'm having trouble with.
Looking to do this algorithm in java. Can someone help?

Write a program in Java though array and pop up element after multiplication [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Inputs ={6,7,8,9,10}
Outputs ={42,56,72,90}
Multiplication needs to be done
// arr[ ] = {6*7,7*8,8*9,9*10}
for i--> input.length
Outputs[i] = input[i]*input[i+1]

double , long in Java use [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
double ps1 = (double) (((double)1)/(double)100);
int maz = (double) ((ps1) * Double.parseDouble(500000.102)));
Is this right to use double, or shall i use long?
I am doing large calculations. And need to keep the correctness of the .102.
Use double! Because long has no signs after , (they have no fraction)

Convert integer to datetime java [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have an integer value with following.How can I convert integer to Datetime?
int input DateTime=1 6 25;
convert input to output
int output DateTime=1:06:25;
With Java 8:
java.time.LocalTime time = java.time.LocalTime.of(hour, minute, second);

Categories

Resources