All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.afu.utils.AfuUtil Maven / Gradle / Ivy

The newest version!
package io.afu.utils;

import io.afu.utils.datetime.DateUtils;
import io.afu.utils.datetime.TimeUtils;
import io.afu.utils.encryption.DESEncrypter;
import io.afu.utils.encryption.DESFileEncryption;
import io.afu.utils.encryption.Md5Encryption;
import io.afu.utils.files.FileUtils;
import io.afu.utils.http.Downloader;
import io.afu.utils.http.Request;
import io.afu.utils.os.RunComand;
import io.afu.utils.os.path.PathUtils;
import io.afu.utils.pdf.PDFUtils;
import io.afu.utils.string.StringUtils;

import java.text.SimpleDateFormat;
import java.util.*;

public class AfuUtil {

    public static void main(String[] args){
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" );
//        try {
//            Date theData = simpleDateFormat.parse("2019-05-25 08:56:21");
//            Calendar c = Calendar.getInstance();
//            c.setTime(theData);
//            c.add(Calendar.DAY_OF_MONTH, 1);
//            Date orderDate  = c.getTime();
//            Date date = simpleDateFormat.parse("2019-05-26 09:00:41");
//            if(orderDate.before(date)){
//                System.out.println(simpleDateFormat.format(date));
//                System.out.println(String.format("CT0012滞纳金或自费金额不一致:签约ID【%s】,orderNo【%s】"));
//            }
//        }catch (Exception e){
//
//        }

//        System.out.println(FileUtils.getFileSuffixSubstringWay("rffanlab.jpg"));

//        System.out.println(StringUtils.getRootDomain("io.afu.io"));
        int[] nums = {2,1};
        moveZeroes(nums);

    }

    public static void reverseString(char[] s) {
        char capacity = '1';
        for (int i=0;i theStringMap = new HashMap<>();
        theStringMap.put("a","23333");
        theStringMap.put("b","324523452");
        theStringMap.put("0","bh2ui3b");
        String orderPatams = CommonUtils.sortMapByAsciiToString(theStringMap);
        System.out.println(orderPatams);
    }

    public static void getToday(){
        String date = DateUtils.getTodayByFormat("yyyyMMddhhmmss");
        System.out.println(date);
    }


    public static void downloadFileAndConvertToImg(String url) throws Exception {
        String fileName = FileUtils.getFileNameByUrl(url);
        String savePath = "D:/tmp/";    // 保存pdf的临时目录
        String realPath = savePath + fileName;
        String imgSavePath = "D:/tmp/"; // 图片保存目录
        try {
            Downloader.d(url,realPath);
            try {
                PDFUtils.convertToImg(realPath,imgSavePath);
            }catch (Exception e){
                // PDF 转换异常处理
            }

        }catch (Exception e){
//            异常处理
        }
    }


    public static void moveZeroes(int[] nums) {
        int zeroPosition = -1;
        boolean firstZero = true;
        for (int i =0;i=0) {
                        nums[zeroPosition] = nums[i];
                        nums[i] = 0;
                        if (nums[zeroPosition+1] == 0) {
                            zeroPosition += 1;
                        }else  {
                            zeroPosition = i;
                            firstZero = true;
                        }
                    }
                }
            }
        }

        System.out.println(1);
    }

    public int[] toSumV2(int[] nums,int target) {
        Map container = new HashMap<>();
        for (int i=0;i params= new HashMap();
            params.put("q","百度");
            String result = Request.makeGetUrl("io/afu/utils/http","www.google.com","/help",params);
            System.out.println("args = [" + result + "]");
        }catch (Exception e){

        }
    }

    public static void useHttpGetRequest(){
        try {
            String content = Request.
                    createDefault().
                    setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36").
                    get("https://www.togit.cc");
            System.out.println("args = [" + content + "]");
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void useHttpPostRequest(){

    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy