Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: display decimal numbers only

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default display decimal numbers only

    what code to use to display decimal numbers only. for example 125.50. the program will only display .50

    this is for android development


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    20,960
    Thanks
    51
    Thanked 2,267 Times in 2,239 Posts

    Default Re: display decimal numbers only

    Are you asking how to strip the 125 from the value: 125.5?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member codepoet's Avatar
    Join Date
    Jul 2014
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: display decimal numbers only

    try the substring() method.
    First get the index of the decimal point, and pass it to the substring() method.
    It will return a string starting from the decimal point until the end of the number.

Similar Threads

  1. working with decimal point numbers
    By raam in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 9th, 2013, 06:29 AM
  2. java -working with decimal numbers
    By raam in forum Member Introductions
    Replies: 2
    Last Post: December 9th, 2013, 04:44 AM
  3. Replies: 1
    Last Post: May 13th, 2013, 05:09 PM
  4. [SOLVED] Rounding Decimal Numbers Question
    By Nuggets in forum Java Theory & Questions
    Replies: 5
    Last Post: March 19th, 2012, 04:12 PM
  5. Logic to implement a program to display decimal place of a number
    By chronoz13 in forum Algorithms & Recursion
    Replies: 2
    Last Post: June 11th, 2009, 03:53 AM