Program to get whole and fractional parts from a double value

public class FarctionalPart {

  public static void main(String[] args) {
  
    // Method 1
    double value = 12.56;
    double fractional_part = value % 1;
    double integral_part = value - fractional_part;
    
    // Method 2
    String numberD = String.valueOf(value);
    // Fractional part
    numberD = numberD.substring(numberD.indexOf ("." ));
    
    // Method 3
    double fract = value - (long) value;

    // Method 4
    value = value - Math.floor(value );
  }
}