What i am trying to do is convert seconds to minutes but it isnt working with something like player.getRemainingTime because the formate that i have setup is secToMin(int) and i want to add something like player.getRemainingTime can someone help me please. Spoiler Code (Text): ERROR:404 Code not found
Code (Text): // Formats seconds into an MM:SS format. String.format("%d:%02d", seconds / 60, seconds % 60); tl;dr each "%" corresponds to a variable (seconds / 60, seconds % 60 in this case). The "d, and 02d" corresponds to a formatting type. You can find a full list, as well as a much better tutorial here.
Is their an easier way because what i am trying to do is this: secToMin(player.getTimeRemaining) which doesnt work because it isnt an int i was wondering if there was some way for me to create it so that i can do this: secToMin(player.getTimeRemaining) to get the remaining time of the player which is converted from seconds to minutes
You can convert it to an int. Casting is used to convert primitives to different types, or an object to its super (or sub) class. Note, casting can and will cause data to be truncated. ex 1. In this case, the class Dog is converted into the subclass "RedDog". Code (Text): Dog dog = new Dog("woof"); RedDog redDog = (RedDog) dog; ex 2. This will print "The number is: 3!" Note how when the double is converted into an int, it loses the ".58385" Code (Text): double number1 = 3.58385; int number2 = (int) number1; System.out.println("The number is: " + number2 + "!"); P.S. Copy the String.format() code I gave you earlier in the thread. It does exactly what you want.
It may surprise you to hear that casting does in fact not convert an object into a new object, and that in your code snippet - given the provided details - the cast is completely redundant.