Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Java: Number to microseconds to decimal.

  • 20-09-2013 10:54am
    #1
    Registered Users, Registered Users 2 Posts: 3,992 ✭✭✭


    Mind is somewhat melted and Google is failing me as i cant seem to form a proper search for this.

    So i have a number of microseconds.

    1 microsecond is 0.000001

    How do I do this in java without messing around with strings etc ?

    So:

    123 -> 0.000123
    2343 -> 0.002343
    56473 -> 0.056473

    Cheers


Comments

  • Closed Accounts Posts: 167 ✭✭dsrckiyisvddht


    Divide it by 1 million?
    int toMicro(int number){
    return number/1000000
    }
    


  • Registered Users, Registered Users 2 Posts: 3,992 ✭✭✭Korvanica


    Divide it by 1 million?
    int toMicro(int number){
    return number/1000000
    }
    

    Sweet seems good. thanks man...


  • Closed Accounts Posts: 167 ✭✭dsrckiyisvddht


    Korvanica wrote: »
    Sweet seems good. thanks man...
    Dont forget to use float/double instead of int or ;

    :P


Advertisement