Archive for category Java

Important Things That Always Needs In Java

1. Setting limited number after decimal point in java:

double relativeSpeed =3.125878;

java.text.DecimalFormat df = new java.text.DecimalFormat();


String r = df.format(relativeSpeed);



2.  Converting string to int

String s = “123”;
int value = Integer.parseInt(s);


3. Converting int to string

int a = 3;
String str = Integer.toString(a);



Leave a comment