public class Convert{
    public static void main(String args[]){
        String num="-12.0";
        int g=0,fnl=0;
        int exp=(num.indexOf(".")-1);
        String num2=num;
        if(num.charAt(0)==('-')){
            num=num.substring(1);
            System.out.println(num);
        }
        String numb=num;
        System.out.println(numb);
        int d=0;
        while(numb.charAt(d)!='.'){
                g=numb.charAt(d)-48;
                System.out.println(g);
                int k = 1;
                for(int f=0;f<exp;f++){
                k=(k*10);
                }
                fnl+=(k*g);
                d++;
                exp--;
                System.out.println(fnl);
        }
        num=(num.substring(d) );
         double num1= Double.parseDouble(num); 
         double finalnum=(fnl+num1);
         System.out.println(fnl);
         if(num2.charAt(0)=='-'){
             finalnum*=-1;
         }
    }
}
I created my own method to convert the integer part of the string and it's only working for positive numbers. :( It should work for both positive and negative numbers. and I used parse double to convert the numbers after the decimal point. I cant use parse double to convert the whole string to double because we're not allowed to do so.