/*
Online Java - IDE, Code Editor, Compiler

Online Java is a quick and easy tool that helps you to build, compile, test your programs online.
*/

public class Main
{
    public static void main(String[] args) {
        System.out.println("Welcome to Online IDE!! Happy Coding :)");
        
        expandedForm(257.24);
    }
    
    public static String expandedForm(Double number)
    {
        String convertedNumber = Double.toString(number); 
       
        //problem has to be treated as two parts... string before and after decimal place.
        
        int positionDecimalPoint= convertedNumber.indexOf('.');
        int remainingChars;
        int roundedNearestUnit;
        
        String charsBeforeDecimal = convertedNumber.substring(0,positionDecimalPoint);
        String charsAfterDecimal = convertedNumber.substring(positionDecimalPoint+1,convertedNumber.length());
        
        int lengthCharsBeforeDecimal = charsBeforeDecimal.length();
        int lengthCharsAfterDecimal =  charsAfterDecimal.length();
        
        System.out.println(charsBeforeDecimal);
        System.out.println(charsAfterDecimal);
        
        for (int i=0; i<charsBeforeDecimal.length();i++)
        {
            //need to create alternate int and round down nearest 100
            //need to know number remaining chars in String
            
            remainingChars = charsBeforeDecimal.length()-1;
            
            // Now remaining characters is used in  10 ^  remainingChars
            // for instance  247  will give  2 x (10 ^ 2) = 200
            
            int prefix = Character.getNumericValue(charsBeforeDecimal.charAt(0)); 
            
            System.out.println("prefix:" + prefix);
            
            
            roundedNearestUnit =  (int) (Math.pow(10,remainingChars) * prefix);
            System.out.println(roundedNearestUnit);
            
            charsBeforeDecimal=charsBeforeDecimal.substring(1,remainingChars);
        }
        
        
        return null;
        
    }
    
}
