A message written in Java bomber (digital version)

Own a program written in Java, running the code within 6 seconds (changed) into the text box to the cursor (QQ, micro-channel transmission block chat, etc.)

code show as below:

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.util.HashMap;
import java.util.Map;
class QQ {
    public void dosomething() {
        //使用map 将控制键盘的常量存起来,好方便取用。
        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
        map.put(0, 0x30);//键盘的0
        map.put(1, 0x31);//键盘的1
        map.put(2, 0x32);//键盘的2
        map.put(3, 0x33);//键盘的3
        map.put(4, 0x34);//键盘的4
        map.put(5, 0x35);//键盘的5
        map.put(6, 0x36);//键盘的6
        map.put(7, 0x37);//键盘的7
        map.put(8, 0x38);//键盘的8
        map.put(9, 0x39);//键盘的9
        try {
            Robot robot = new Robot();
            robot.delay(6000);//延迟6秒供你打开编辑器,时间可更改
         
            //让机器从0数到200(数字可以更改,最大为999)
            for (int i = 0; i < 201; i++) {
            
                // 个位数的处理
                if (i <= 9) {
                    robot.keyPress(map.get(i));
                    robot.keyPress(KeyEvent.VK_ENTER);
                }
          
                // 两位数的处理
                if (i > 9 && i <= 99) {
                    int a = i / 10;// 十位
                    int b = i % 10;// 个位
                    robot.keyPress(map.get(a));
                    robot.keyPress(map.get(b));
                    robot.keyPress(KeyEvent.VK_ENTER);
                }
          
                // 三位数的处理
                if (i > 99 && i <= 200) {
                    int a = i / 100;// 百位
                    int b = (i % 100) / 10;// 十位
                    int c = i % 10;// 个位
                    robot.keyPress(map.get(a));
                    robot.keyPress(map.get(b));
                    robot.keyPress(map.get(c));
                    robot.keyPress(KeyEvent.VK_ENTER);
                }
            }
        } catch (AWTException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
 
    public static void main(String[] args) {
        QQ bh = new QQ();
        bh.dosomething();
    }
}

Note: The numbers are not issued the order
Meng new white, are learning stage, you can publish the code in order to exchange experiences exchange
codes and any similarity to delete this article can contact me (If I have offended, hope forgive me)

Released five original articles · won praise 5 · Views 118

Guess you like

Origin blog.csdn.net/weixin_44145894/article/details/105119248