Cast int to float
public class Main{ public static void main(String[] args) { for(int i = 50; i < 150; i++) { System.out.print((float) i); System.out.print(" "); }/*from w w w . ja v a2 s. c om*/ } }