Hi Experts,
I want a simple java function tht takes 17 digits including '.' and i want output of 15 digits ( if . is in last place , exclude that also.

Condtions :
If input for the java function is <=15 digits --> output from java function is same number

If input for the java function is >15 digits --> output from java function should be 15 digits only
EX: Input to the function is: 1234567890123.456 then Output should be displayed as: 1234567890123.4

Input to the function is: 12345678901234.56 then Output should be displayed as: 12345678901234 à this excluding ‘.’

Input to the function is: 123456789012345.6 then Output should be displayed as: 123456789012345

please help me

So, use a array. That's the simple way I think you have to do it. Count the number of elements and handle it with the length property of the array and your conditions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.