Question: I'm making a basic calculator where you can plus, times, divide and minus as i was experimenting to see if it worked i noticed that instead of 5 divided by being equal to 1.25 it only displayed 1. 

Here's the code i use to handle the math problems: 

```
if (box.getSelectedItem().equals(divide)){
    JOptionPane.showMessageDialog(null, Integer.parseInt(first.getText()) / Integer.parseInt(second.getText()), "Answer", -1);
    main(args);
}

```

Is there code that displays the decimal points as well?

Answer: 
Since you are using Integer,it is happening.
Use [Double](http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html) to preserve decimals.
In your case,use

```
Double.parseDouble(first.getText()) / Double.parseDouble(second.getText())

```
You need to do the casting

```
(double)parseInt(first.getText()) / (double)parseInt(second.getText())

```

Int/Int will give you an Integer. So you need to cast it to Double to get the result in decimal.

**EDIT:**

If you dont want to show decimal when the result is a whole number then you need to check it like this:

```
Double res = (double)parseInt(first.getText()) / (double)parseInt(second.getText())
 Integer x;
 if(res % 1 == 0)
 {
    x =  (int)res
 }

```