Is there a one-liner for this function?
int side = width &l开发者_Python百科t; height ? width : height;
width = side;
height = side;
width = height = width < height ? width : height;
It is possible:
width = height = width < height ? width : height;
However it's generally not the convention in Java to assign multiple variables on one line.
width = height = Math.min(width, height);
height = width = width < height ? width : height;
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论