how to efficiently draw line numbers in edittext ondraw without causing lag in scrolling
// I use short variable names because i think
// they are executed
much faster.

You are wrong. Execution speed does not depend on the length of identifiers anyhow.

// i use an array here for efficient
// random access to store the
// positions where the line numbers
// will be according to the number
// of lines


As usual the use of (primitive) arrays leads to procedural solution involving al lot of looping. Unnecessary looping is the most common performance issue.

   // now i loop thru all the numbers
   // replacing the characters in the array
   // (with spaces) with numbers


Instead of looping you should calculate what you need.
Because of your poor naming I'm not analyzing in detail what your code really does, but it looks like in mainly calculates the indentation needed.
Given the number of the current line and the overall line count I would do it this way:
 // this could also be a member variable 
 // so that it does not need to be 
 // calculated each time the draw method runs
 int indentedNumberWith =
           String.valueOf(lineCount).length();

 String indentedLineNumber =
           String.format(
                         &quot;% &quot;+indentedNumberWith+&quot;s&quot;,
              // note this ^ space
                         String.valueOf(lineNumber));

This should replace the loop with the if cascade...