Skip to content

Tag: java

How to round and scale a number using DecimalFormat

I’m trying to to format a number using the DecimalFormat but the problem that I didn’t get the expected result. Here is the problem: I have this number: 1439131519 and I want to print only the five first digits but with a comma after 4 digits like this: 1439,1. I have tried to use DecimalFormat bu…

What code solution to these ranges in java [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 last year. Improve this question Hello I would like to make a method that takes a given weight and windspeed …

Avoiding circular depenency between Arena and Portal

I’m trying to resolve this ciruclar dependency while preferebly keeping both objects immutable. Basically, I need portal to be able to activate itself, and start the arena. Opposite, I need Arena to reset & close itself, and the portal. I found a solution by having two HashMap’s <Arena, Por…

How to send variable to method through an arraylist

I’m not very good at explaining things but can someone try to explain to me why my user input variables are not being sent to my methods in another class? This is my main class: } This is an example of one of my subclasses that I am trying to send the variables to. All the other ones are the

How to replace all substrings?

I want to replace all the text within brackets to uppercase letters for any String object. For example if the text is – Hi (abc), how (a)re (You)?” , output should be – Hi ABC, how Are YOU? . I tried to use StringUtils.SubstringBetween(), but that replaces only the first substring between ()…