Linked Questions

87 votes
5 answers
409k views

May be this is silly question. I want to get rid of the fractional part of the Double number. But I cant do that. It shows the error that incompatible types. What to do? Double to int conversion in ...
Selvin's user avatar
  • 12.5k
1 vote
2 answers
2k views

I am writing a JUnit test case for a method that has a getValue() method which returns an Object, the getValue() returns the value I pass inside setValue() and In this case when I pass a double value ...
hushie's user avatar
  • 457
-1 votes
4 answers
464 views

I want to know what happened when Double invert to int on my example? this case is right Double d = 123.13; int i = (int)(Math.random()*d); this case is wrong Double d = 123.13; int i = (int)(d); ...
achilles0009's user avatar
-9 votes
7 answers
3k views

I am having a ArrayList<String> abc in which I am getting this value [64.3, 25.1, 44.3, 34.2, 6.4, 48.5, 35.5, 59.5, 54.6, 26.6, 11.2, 50.3, 25.1] Now I want to extract the integer values ...
Android Geek's user avatar
-4 votes
2 answers
237 views

A project I have requires the movement of a player at a coordinate using getX and getY, however, I am confused on how to convert getX and getY from a double to an int so i can play them in the drawing ...
Alec Koshki's user avatar
12 votes
8 answers
52k views

What is the best way to convert a double to String without decimal places? What about String.valueOf((int) documentNumber)? The doubles always have 0 after the decimal dot. I don't need to round or ...
John Alexander Betts's user avatar
3 votes
4 answers
8k views

I am trying to convert an ArrayList to ArrayList. I am having actually a list of labels in Double and I want to create a list of Integers. I am trying to add the one to another but of course I need a ...
snake plissken's user avatar
2 votes
5 answers
6k views

I get a double value (eg. -3.1234) which contains a value in decimals (0.1234 in this case). I want to remove the value in decimal value (in this case I wanted the value -3). How do I do it? I know ...
user avatar
-1 votes
2 answers
2k views

How do I convert/cast a Double object to an int? Double d = new Double(12.34); int i = 12 //is what I'm looking for If I had a double I would just use: double z = 12.34; int i = (int)z; Note: I want ...
Sheldon's user avatar
  • 1,223
0 votes
3 answers
3k views

For my simple calculator, I am showing the result in a TextView, but it is always showing decimals. How can I remove them ? This is my code : public class MainActivity extends Activity implements ...
JURAIJ's user avatar
  • 11
1 vote
2 answers
443 views

While I'm doing typecast from float to int type and typecast from Integer to int it is working. But while i am trying to typecast from Float to int type I'm getting the error as "incompatible type". ...
Ram Thota's user avatar
  • 587
0 votes
3 answers
418 views

I use a method to get Data from a database and store it in a vector. The method will always return a Vector of Objects where the Object datatype can be either a Date, a Double or a String. In my case, ...
user avatar
0 votes
3 answers
294 views

public void colortemperatureJSliderStateChanged(ChangeEvent event) { fahrenheitdegree = colortemperatureJSlider.getValue(); fahrenheitJPanel.setBounds(100,270, fahrenheitdegree, 20); ...
blacklune's user avatar
0 votes
2 answers
137 views

I have a CSV file which has data on it such as: File % Diff testfile0.xml 44.948 testfile1.xml 22.232 testfile2.xml 45.343 testfile3.xml 2.345 testfile4.xml -3.948 testfile5.xml 22....
arabian_albert's user avatar