/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		System.out.println("3.125 can be perfectly represented in base 2 :");
		System.out.println(getDigits(3.125));
		System.out.println("But 3.1415 can't :");
		System.out.println(getDigits(3.1415));
	}
	
	public static List<Integer> getDigits(double d) {
		List<Integer> result = new ArrayList<>();
		while (d > 0) {
		    int mostSignificantDigit = (int) d;
		    result.add(mostSignificantDigit);
		    d = (d - mostSignificantDigit) * 10;
		}
		return result;
	}
}