Working out how long a sample is

ok it’s easy enough to get the millisecond value from a Clip, but how would do you get it from using an AudioInputStream and AudioFormat? it’s probably really simple but i just can’t get my head around this…

never mind i figured the equation out my self.

Would you please like to share how you did it?I am trying to do something similar to this.
Thanks in advance