private String justifyTextLine(TextPaint textPaint,String lineString,int textAreaWidth){
  int gapIndex=0;
  float lineWidth=textPaint.measureText(lineString);
  while (lineWidth < textAreaWidth && lineWidth > 0) {
    gapIndex=lineString.indexOf(" ",gapIndex + 2);
    if (gapIndex == -1) {
      gapIndex=0;
      gapIndex=lineString.indexOf(" ",gapIndex + 1);
      if (gapIndex == -1)       return lineString;
    }
    lineString=lineString.substring(0,gapIndex) + "  " + lineString.substring(gapIndex + 1,lineString.length());
    lineWidth=textPaint.measureText(lineString);
  }
  return lineString;
}

private String justifyTextLine ( TextPaint textPaint , String lineString , int textAreaWidth ) { int gapIndex = 0 ; float lineWidth = textPaint . measureText ( lineString ) ; while ( lineWidth < textAreaWidth && lineWidth > 0 ) { gapIndex = lineString . indexOf ( " " , gapIndex + 2 ) ; if ( gapIndex == - 1 ) { gapIndex = 0 ; gapIndex = lineString . indexOf ( " " , gapIndex + 1 ) ; if ( gapIndex == - 1 ) return lineString ; } lineString = lineString . substring ( 0 , gapIndex ) + "  " + lineString . substring ( gapIndex + 1 , lineString . length ( ) ) ; lineWidth = textPaint . measureText ( lineString ) ; } return lineString ; }
this method add space in line until line width become equal to textareawidth
